51 |
this.style = style; |
this.style = style; |
52 |
} |
} |
53 |
|
|
54 |
public void place(Cell c, VobScene v, int cs, float w, float h, |
public void place(Cell c, VobScene v, Box box, |
55 |
ViewContext context, float scale) { |
ViewContext context, float scale) { |
56 |
String s = c.t(); |
String s = c.t(); |
57 |
if (s == null) s = ""; |
if (s == null) s = ""; |
77 |
float left = style.getWidth(s.substring(0, center), scale); |
float left = style.getWidth(s.substring(0, center), scale); |
78 |
float right = width - left; |
float right = width - left; |
79 |
|
|
80 |
float middle = w / 2.0f; |
float middle = box.getWidth() / 2.0f; |
81 |
|
|
82 |
float skew; |
// Possibly offset text so cursor is visible. |
83 |
if(width < w) skew = 0; |
float textOffset; |
84 |
else if(left < middle) skew = 0; |
if(width < box.getWidth()) textOffset = 0; |
85 |
else if(right < middle) skew = (- width + w); |
else if(left < middle) textOffset = 0; |
86 |
else skew = (- left + middle); |
else if(right < middle) textOffset = (- width + box.getWidth()); |
87 |
|
else textOffset = (- left + middle); |
88 |
|
|
89 |
Object key = (line < KEY.length) ? KEY[line] : new Integer(line+1); |
Object key = (line < KEY.length) ? KEY[line] : new Integer(line+1); |
90 |
int skewedcs = v.coordsys(cs, key, 0, skew, 0, 2, 2); |
int offsetcs = v.coordsys(box.getWHCoordsys(), key, 0, textOffset, 0, 1, 1); |
91 |
|
|
92 |
placeVob(c, v, skewedcs, w, h, brBefore, brAfter, offs, context, scale); |
placeVob(c, v, offsetcs, box.getWidth(), box.getHeight(), brBefore, brAfter, offs, context, scale); |
93 |
} |
} |
94 |
|
|
95 |
static Object WH_KEY = new Object(); |
static Object WH_KEY = new Object(); |