1
|
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js'
|
2
|
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js 2015-10-15 20:11:45 +0000
|
3
|
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js 2015-10-23 09:59:53 +0000
|
4
|
@@ -475,12 +475,12 @@
|
5
|
var maxWidth = me.readInt16BinaryMessage(message, offset);
|
6
|
offset = offset + 2;
|
7
|
|
8
|
- var pheight = p2j.screen.layoutParagraphWorker(text,
|
9
|
+ var pheight = p2j.screen.layoutParagraphWorker(null,
|
10
|
+ text,
|
11
|
font,
|
12
|
0,
|
13
|
0,
|
14
|
- maxWidth,
|
15
|
- false);
|
16
|
+ maxWidth);
|
17
|
|
18
|
me.sendInt16BinaryMessage(0x06, pheight);
|
19
|
break;
|
20
|
|
21
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js'
|
22
|
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js 2015-10-22 09:11:20 +0000
|
23
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js 2015-10-23 09:58:26 +0000
|
24
|
@@ -734,7 +734,7 @@
|
25
|
// TODO: this might need to be 'bottom', too
|
26
|
this.ctx.textBaseline = 'top';
|
27
|
|
28
|
- me.layoutParagraphWorker(text, fontId, x, y, width, true);
|
29
|
+ me.layoutParagraphWorker(this.ctx, text, fontId, x, y, width);
|
30
|
|
31
|
break;
|
32
|
case ops.DRAW_LINE:
|
33
|
@@ -2004,7 +2004,8 @@
|
34
|
* paragraph height while maintaining the supplied maximum width.
|
35
|
*
|
36
|
* @param {CanvasRenderingContext2D} ctx
|
37
|
- * The canvas 2D graphics context on which to draw.
|
38
|
+ * The canvas 2D graphics context on which to draw, when <code>ctx</code> is set,
|
39
|
+ * the text should be drawn.
|
40
|
* @param {String} txt
|
41
|
* The paragraph text.
|
42
|
* @param {Number} font
|
43
|
@@ -2015,18 +2016,14 @@
|
44
|
* The drawing Y position, ignored if drawing is not required.
|
45
|
* @param {Number} width
|
46
|
* The maximum width used to layout the paragraph.
|
47
|
- * @param {boolean} draw
|
48
|
- * When <code>true</code>, this flag indicates that the text should be drawn on the
|
49
|
- * current context.
|
50
|
*
|
51
|
* @return {Number} The paragraph height.
|
52
|
*/
|
53
|
- me.layoutParagraphWorker = function(ctx, txt, font, x, y, width, draw)
|
54
|
+ me.layoutParagraphWorker = function(ctx, txt, font, x, y, width)
|
55
|
{
|
56
|
var newLine = true;
|
57
|
var i = 0;
|
58
|
-
|
59
|
- if (draw)
|
60
|
+ if (ctx)
|
61
|
{
|
62
|
// unless we are drawing, there is no need in changing the context font
|
63
|
ctx.save();
|
64
|
@@ -2036,14 +2033,13 @@
|
65
|
|
66
|
var height = 0;
|
67
|
var fheight = p2j.fonts.getFontHeight(font);
|
68
|
-
|
69
|
while (i < txt.length)
|
70
|
{
|
71
|
- var nextPos = findNextPos(txt, i, width);
|
72
|
+ var nextPos = findNextPos(font, txt, i, width);
|
73
|
|
74
|
var line = txt.substring(i, nextPos);
|
75
|
|
76
|
- if (draw)
|
77
|
+ if (ctx)
|
78
|
{
|
79
|
ctx.fillText(line, x, y);
|
80
|
}
|
81
|
@@ -2054,7 +2050,7 @@
|
82
|
height = height + fheight;
|
83
|
}
|
84
|
|
85
|
- if (draw)
|
86
|
+ if (ctx)
|
87
|
{
|
88
|
ctx.restore();
|
89
|
}
|
90
|
|