Commit 9ca53e5c authored by Christoffer Ackelman's avatar Christoffer Ackelman

Web: Refactor GlowTransform.

parent ee8bb1e9
......@@ -203,21 +203,16 @@ class GlowNodeClass {
Math.abs(base.y0 - base.y1) < Number.MIN_VALUE)) {
// Borders are given i x0, y0, x1, y1
// Will not work in rotated nodes
let kx1, kx2, ky1, ky2;
let k1 = new Point(base.x0, base.y0);
let k2 = new Point(base.x1, base.y1);
if (t === null) {
kx1 = base.x0;
kx2 = base.x1;
ky1 = base.y0;
ky2 = base.y1;
} else {
kx1 = t.x(base.x0, base.y0);
kx2 = t.x(base.x1, base.y1);
ky1 = t.y(base.x0, base.y0);
ky2 = t.y(base.x1, base.y1);
if (t !== null) {
k1 = t.apply(k1);
k2 = t.apply(k2);
}
g.set(Rect.union(g, new Rect(Math.min(kx1, kx2), Math.min(ky1, ky2), Math.max(kx1, kx2), Math.max(ky1, ky2))));
g.set(Rect.union(g, new Rect(Math.min(k1.x, k2.x), Math.min(k1.y, k2.y),
Math.max(k1.x, k2.x), Math.max(k1.y, k2.y))));
} else {
this.a.forEach(e => e.get_borders(t, g));
}
......
......@@ -5,7 +5,7 @@ class GlowRect {
draw_type;
line_width;
display_level;
fill;
fill: boolean;
constructor(ctx) {
this.ctx = ctx;
......@@ -32,7 +32,7 @@ class GlowRect {
this.display_level = parseInt(tokens[1], 10);
break;
case GlowSave.Rect_fill:
this.fill = parseInt(tokens[1], 10);
this.fill = Boolean(parseInt(tokens[1], 10));
break;
case GlowSave.Rect_ll:
i = this.ll.open(lines, i + 1);
......@@ -51,9 +51,11 @@ class GlowRect {
return i;
}
draw(highlight, hot) {
}
draw_shadow(border, shadow, highlight, hot) {
draw(pos, highlight = 0, hot = 0, node = null) {
let idx = this.line_width + hot;
idx = clamp(idx, 0, DRAW_TYPE_SIZE - 1);
this.ctx.gdraw.rect(this.ll.x + pos.x, this.ll.y + pos.y,
this.ur.x - this.ll.x, this.ur.y - this.ll.y,
this.draw_type, this.fill, idx * this.fill, highlight);
}
}
\ No newline at end of file
......@@ -47,9 +47,10 @@ class GlowText {
return i;
}
draw(hightlight, hot) {
}
draw_shadow(border, shadow, hightlight, hot) {
draw(pos, hightlight = 0, hot = 0, node = null) {
let idx = clamp(this.text_size, 0, DRAW_TYPE_SIZE - 1);
this.ctx.gdraw.text(this.p.x + pos.x, this.p.y + pos.y, this.text,
this.draw_type, this.color_drawtype, idx, hightlight, Font.Helvetica,
(8 + 2 * this.text_size));
}
}
\ No newline at end of file
class GlowTransform {
class Matrix {
a11 = 1;
a12 = 0;
a13 = 0;
......@@ -6,24 +6,60 @@ class GlowTransform {
a22 = 1;
a23 = 0;
rotation = 0;
s: GlowTransform;
stored = false;
set(o: GlowTransform) {
this.a11 = o.a11;
this.a12 = o.a12;
this.a13 = o.a13;
this.a21 = o.a21;
this.a22 = o.a22;
this.a23 = o.a23;
this.rotation = o.rotation;
set(m: Matrix) {
this.a11 = m.a11;
this.a12 = m.a12;
this.a13 = m.a13;
this.a21 = m.a21;
this.a22 = m.a22;
this.a23 = m.a23;
this.rotation = m.rotation;
}
apply(p: Point) {
return new Point(
p.x * this.a11 + p.y * this.a12 + this.a13,
p.x * this.a21 + p.y * this.a22 + this.a23
);
}
static multiply(a, b) {
if (b === null) {
return a;
}
if (a === null) {
return b;
}
let tmp = new Matrix();
tmp.a11 = a.a11 * b.a11 + a.a12 * b.a21;
tmp.a12 = a.a11 * b.a12 + a.a12 * b.a22;
tmp.a13 = a.a11 * b.a13 + a.a12 * b.a23 + a.a13;
tmp.a21 = a.a21 * b.a11 + a.a22 * b.a21;
tmp.a22 = a.a21 * b.a12 + a.a22 * b.a22;
tmp.a23 = a.a21 * b.a13 + a.a22 * b.a23 + a.a23;
tmp.rotation = a.rotation + b.rotation;
return tmp;
}
vertical_scale() {
return Math.sqrt(this.a12 * this.a12 + this.a22 * this.a22);
}
}
class GlowTransform extends Matrix {
s: Matrix;
stored = false;
store() {
this.s.set(this);
this.stored = true;
}
revert() {
this.set(this.s);
}
open(lines, row) {
let i;
for (i = row; i < lines.length; i++) {
......@@ -65,68 +101,6 @@ class GlowTransform {
return i;
}
rot() {
if (arguments.length === 1 && arguments[0] !== null) {
let t = arguments[0];
return t.rotation + this.rotation;
} else {
return this.rotation;
}
}
x() {
if (arguments.length === 3 && arguments[0] !== null) {
let t = arguments[0];
let x1 = arguments[1];
let y1 = arguments[2];
let tmp = GlowTransform.multiply(t, this);
return x1 * tmp.a11 + y1 * tmp.a12 + tmp.a13;
} else {
let x1 = arguments[0];
let y1 = arguments[1];
return x1 * this.a11 + y1 * this.a12 + this.a13;
}
}
y() {
if (arguments.length === 3 && arguments[0] !== null) {
let t = arguments[0];
let x1 = arguments[1];
let y1 = arguments[2];
let tmp = GlowTransform.multiply(t, this);
return x1 * tmp.a21 + y1 * tmp.a22 + tmp.a23;
} else {
let x1 = arguments[0];
let y1 = arguments[1];
return x1 * this.a21 + y1 * this.a22 + this.a23;
}
}
static multiply(a, b) {
let tmp = new GlowTransform();
tmp.a11 = a.a11 * b.a11 + a.a12 * b.a21;
tmp.a12 = a.a11 * b.a12 + a.a12 * b.a22;
tmp.a13 = a.a11 * b.a13 + a.a12 * b.a23 + a.a13;
tmp.a21 = a.a21 * b.a11 + a.a22 * b.a21;
tmp.a22 = a.a21 * b.a12 + a.a22 * b.a22;
tmp.a23 = a.a21 * b.a13 + a.a22 * b.a23 + a.a23;
tmp.rotation = a.rotation + b.rotation;
return tmp;
}
set_from_stored(t) {
this.set(GlowTransform.multiply(t, this.s));
this.a11 = t.a11 * this.s.a11 + t.a12 * this.s.a21;
this.a12 = t.a11 * this.s.a12 + t.a12 * this.s.a22;
this.a13 = t.a11 * this.s.a13 + t.a12 * this.s.a23 + t.a13;
this.a21 = t.a21 * this.s.a11 + t.a22 * this.s.a21;
this.a22 = t.a21 * this.s.a12 + t.a22 * this.s.a22;
this.a23 = t.a21 * this.s.a13 + t.a22 * this.s.a23 + t.a23;
this.rotation = this.s.rotation + t.rotation;
}
scale(sx, sy, x0, y0) {
this.a13 = this.a13 * sx + x0 * (1 - sx);
this.a23 = this.a23 * sy + y0 * (1 - sy);
......@@ -136,15 +110,6 @@ class GlowTransform {
this.a22 *= sy;
}
scale_from_stored(sx, sy, x0, y0) {
this.a13 = this.s.a13 * sx + x0 * (1 - sx);
this.a23 = this.s.a23 * sy + y0 * (1 - sy);
this.a11 = this.s.a11 * sx;
this.a12 = this.s.a12 * sx;
this.a21 = this.s.a21 * sy;
this.a22 = this.s.a22 * sy;
}
rotate(angle, x0, y0) {
let sin_a;
let cos_a;
......@@ -176,28 +141,6 @@ class GlowTransform {
this.rotation += angle;
}
rotate_from_stored(angle, x0, y0) {
let sin_a;
let cos_a;
if (-90.01 < this.s.rotation + angle && this.s.rotation + angle < -89.99) {
sin_a = -1.0;
cos_a = 0.0;
} else {
sin_a = Math.sin((this.s.rotation + angle) / 180 * 3.14159);
cos_a = Math.cos((this.s.rotation + angle) / 180 * 3.14159);
}
this.a11 = this.s.a11 * cos_a - this.s.a21 * sin_a;
this.a12 = this.s.a12 * cos_a - this.s.a22 * sin_a;
this.a13 =
this.s.a13 * cos_a - this.s.a23 * sin_a + x0 * (1 - cos_a) + y0 * sin_a;
this.a21 = this.s.a11 * sin_a + this.s.a21 * cos_a;
this.a22 = this.s.a21 * sin_a + this.s.a22 * cos_a;
this.a23 =
this.s.a13 * sin_a + this.s.a23 * cos_a + y0 * (1 - cos_a) - x0 * sin_a;
this.rotation = this.s.rotation + angle;
}
move(x0, y0) {
this.a13 += x0;
this.a23 += y0;
......@@ -214,7 +157,7 @@ class GlowTransform {
}
reverse(x, y) {
let p = new GlowPoint();
let p = new Point();
if (this.a11 === 0 || (this.a12 * this.a21 - this.a11 * this.a22) === 0) {
if (this.a11 === 0 && this.a22 === 0 && this.a12 !== 0 &&
this.a21 !== 0) {
......@@ -233,16 +176,6 @@ class GlowTransform {
return p;
}
vertical_scale(t) {
if (t === null) {
return Math.sqrt(this.a12 * this.a12 + this.a22 * this.a22);
}
let tmp = GlowTransform.multiply(t, this);
return Math.sqrt(tmp.a12 * tmp.a12 + tmp.a22 * tmp.a22);
}
is_stored() {
return this.stored;
}
......
......@@ -49,7 +49,7 @@ class GrowAnnot extends GlowAnnot {
return;
}
let trf_scale = this.trf.vertical_scale(t);
let trf_scale = Matrix.multiply(this.trf, t).vertical_scale();
let idx = Math.floor(trf_scale * this.ctx.mw.zoom_factor_y /
this.ctx.mw.base_zoom_factor * (this.text_size + 4) - 3);
let tsize = trf_scale * this.ctx.mw.zoom_factor_y /
......@@ -75,11 +75,15 @@ class GrowAnnot extends GlowAnnot {
ldraw_type = this.draw_type;
}
let x1 = Math.floor((this.trf.x(t, this.p.x, this.p.y) + offset_x) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor((this.trf.y(t, this.p.x, this.p.y) + offset_y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let rot = Math.floor(this.trf.rot(t));
let tmp = Matrix.multiply(this.trf, t);
let p = tmp.apply(this.p);
let x1 = Math.floor((p.x + offset_x) * this.ctx.mw.zoom_factor_x) -
this.ctx.mw.offset_x;
let y1 = Math.floor((p.y + offset_y) * this.ctx.mw.zoom_factor_y) -
this.ctx.mw.offset_y;
let rot = t ? this.trf.rotation + t.rotation : this.trf.rotation;
rot = Math.floor(rot);
rot = rot < 0 ? rot % 360 + 360 : rot % 360;
switch (this.annot_type) {
......@@ -157,7 +161,7 @@ class GrowAnnot extends GlowAnnot {
return new Point();
}
let trf_scale = this.trf.vertical_scale(t);
let trf_scale = Matrix.multiply(this.trf, t).vertical_scale();
let idx = Math.floor(trf_scale * this.ctx.mw.zoom_factor_y /
this.ctx.mw.base_zoom_factor * (this.text_size + 4) - 4);
let tsize = trf_scale * this.ctx.mw.zoom_factor_y /
......
......@@ -169,29 +169,24 @@ class GrowArc extends GlowArc {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = Math.floor(this.trf.x(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let rot = Math.floor(this.trf.rot(t));
let tmp = Matrix.multiply(t, this.trf);
let p = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
let x1 = Math.floor(p.x * this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(p.y * this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let rot = Math.floor(tmp.rotation);
if (rot % 90 !== 0 &&
Math.abs((this.ur.x - this.ll.x) - (this.ur.y - this.ll.y)) <
Number.MIN_VALUE) {
let tmp = t ? GlowTransform.multiply(t, this.trf) : this.trf;
let scale = this.trf.vertical_scale(tmp);
let x_c = ((this.trf.x(t, this.ll.x, this.ll.y) * this.ctx.mw.zoom_factor_x -
this.ctx.mw.offset_x) +
(this.trf.x(t, this.ur.x, this.ur.y) * this.ctx.mw.zoom_factor_x -
this.ctx.mw.offset_x)) / 2;
let y_c = ((this.trf.y(t, this.ll.x, this.ll.y) * this.ctx.mw.zoom_factor_y -
this.ctx.mw.offset_y) +
(this.trf.y(t, this.ur.x, this.ur.y) * this.ctx.mw.zoom_factor_y -
this.ctx.mw.offset_y)) / 2;
let scale = tmp.vertical_scale();
let x_c = ((p.x * this.ctx.mw.zoom_factor_x - this.ctx.mw.offset_x) +
(p2.x * this.ctx.mw.zoom_factor_x - this.ctx.mw.offset_x)) / 2;
let y_c = ((p.y * this.ctx.mw.zoom_factor_y - this.ctx.mw.offset_y) +
(p2.y * this.ctx.mw.zoom_factor_y - this.ctx.mw.offset_y)) / 2;
x1 = Math.floor(-scale *
((this.ur.x - this.ll.x) / 2 * this.ctx.mw.zoom_factor_x) + x_c + 0.5);
......@@ -333,12 +328,12 @@ class GrowArc extends GlowArc {
}
get_borders(t, g) {
let x1 = this.trf.x(t, this.ll.x, this.ll.y);
let x2 = this.trf.x(t, this.ur.x, this.ur.y);
let y1 = this.trf.y(t, this.ll.x, this.ll.y);
let y2 = this.trf.y(t, this.ur.x, this.ur.y);
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
g.set(Rect.union(g, new Rect(Math.min(x1, x2), Math.min(y1, y2), Math.max(x1, x2), Math.max(y1, y2))));
g.set(Rect.union(g, new Rect(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y),
Math.max(p1.x, p2.x), Math.max(p1.y, p2.y))));
}
get_background_object_limits(t, type, x, y, bo) {
......
......@@ -202,16 +202,17 @@ class GrowAxis extends GrowRect {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = Math.floor(this.trf.x(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let rotation =
(this.trf.rot(t) / 360 - Math.floor(this.trf.rot(t) / 360)) * 360;
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let rotation = t ? this.trf.rotation + t.rotation : this.trf.rotation;
rotation = (rotation / 360 - Math.floor(rotation / 360)) * 360;
let ll_x = Math.min(x1, x2);
let ur_x = Math.max(x1, x2);
......@@ -459,15 +460,15 @@ class GrowAxis extends GrowRect {
this.max_value = maxval;
this.min_value = minval;
let x1 = Math.floor(this.trf.x(this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let rotation = (this.trf.rot() / 360 - Math.floor(this.trf.rot() / 360)) *
let p1 = this.trf.apply(this.ll);
let p2 = this.trf.apply(this.ur);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let rotation = (this.trf.rotation / 360 - Math.floor(this.trf.rotation / 360)) *
360;
if (keep_settings === 0) {
......
......@@ -133,16 +133,17 @@ class GrowAxisArc extends GrowArc {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = Math.floor(this.trf.x(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let rotation =
(this.trf.rot(t) / 360 - Math.floor(this.trf.rot(t) / 360)) * 360;
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let rotation = t ? this.trf.rotation + t.rotation : this.trf.rotation;
rotation = (rotation / 360 - Math.floor(rotation / 360)) * 360;
let ll_x = Math.min(x1, x2);
let ur_x = Math.max(x1, x2);
......@@ -250,15 +251,15 @@ class GrowAxisArc extends GrowArc {
this.max_value = maxval;
this.min_value = minval;
let x1 = Math.floor(this.trf.x(this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let rotation = (this.trf.rot() / 360 - Math.floor(this.trf.rot() / 360)) *
let p1 = this.trf.apply(this.ll);
let p2 = this.trf.apply(this.ur);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let rotation = (this.trf.rotation / 360 - Math.floor(this.trf.rotation / 360)) *
360;
if (keep_settings === 0) {
......
......@@ -108,20 +108,20 @@ class GrowBar extends GrowRect {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = Math.floor(this.trf.x(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let ll_x = Math.min(x1, x2);
let ur_x = Math.max(x1, x2);
let ll_y = Math.min(y1, y2);
let ur_y = Math.max(y1, y2);
if (this.fill !== 0) {
if (this.fill) {
let drawtype =
GlowColor.get_drawtype(this.fill_drawtype, DrawType.FillHighlight,
highlight, colornode, 1, 0);
......@@ -130,7 +130,7 @@ class GrowBar extends GrowRect {
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
drawtype, true, 0);
} else {
let rotation = (t) ? this.trf.rot(t) : this.trf.rot();
let rotation = (t) ? this.trf.rotation + t.rotation : this.trf.rotation;
let fa1, fa2;
if (this.gradient_contrast >= 0) {
......@@ -155,7 +155,7 @@ class GrowBar extends GrowRect {
if (this.max_value !== this.min_value) {
let x0, y0, width, height, l_x0, l_y0, l_x1, l_y1;
let rotation = (t) ? this.trf.rot(t) : this.trf.rot();
let rotation = (t) ? this.trf.rotation + t.rotation : this.trf.rotation;
rotation = (rotation / 360 - Math.floor(rotation / 360)) * 360;
x0 = ll_x;
y0 = ll_y;
......@@ -201,7 +201,7 @@ class GrowBar extends GrowRect {
if (grad === Gradient.No) {
this.ctx.gdraw.rect(x0, y0, width, height, dt, true, 0);
} else {
rotation = (t) ? this.trf.rot(t) : this.trf.rot();
rotation = (t) ? this.trf.rotation + t.rotation : this.trf.rotation;
let fb1, fb2;
if (this.gradient_contrast >= 0) {
......
......@@ -92,16 +92,17 @@ class GrowBarArc extends GrowArc {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = Math.floor(this.trf.x(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let rotation =
(this.trf.rot(t) / 360 - Math.floor(this.trf.rot(t) / 360)) * 360;
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let rotation = t ? this.trf.rotation + t.rotation : this.trf.rotation;
rotation = (rotation / 360 - Math.floor(rotation / 360)) * 360;
let ll_x = Math.min(x1, x2);
let ur_x = Math.max(x1, x2);
......
......@@ -136,15 +136,17 @@ class GrowBarChart extends GrowRect {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = Math.floor(this.trf.x(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let rot = Math.floor(this.trf.rot(t));
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let rot = t ? this.trf.rotation + t.rotation : this.trf.rotation;
rot = Math.floor(rot);
let ll_x = Math.min(x1, x2);
let ur_x = Math.max(x1, x2);
......
......@@ -386,20 +386,19 @@ class GrowFolder extends GrowWindow {
(8 + 2 * this.text_size);
text_idx = Math.min(text_idx, DRAW_TYPE_SIZE - 1);
let dx1 = this.trf.x(t, this.ll.x, this.ll.y);
let dy1 = this.trf.y(t, this.ll.x, this.ll.y);
let dx2 = this.trf.x(t, this.ur.x, this.ur.y);
let dy2 = this.trf.y(t, this.ur.x, this.ur.y);
dx1 = Math.min(dx1, dx2);
dx2 = Math.max(dx1, dx2);
dy1 = Math.min(dy1, dy2);
dy2 = Math.max(dy1, dy2);
let tmp = Matrix.multiply(this.trf, t);
let d1 = tmp.apply(this.ll);
let d2 = tmp.apply(this.ur);
d1.x = Math.min(d1.x, d2.x);
d2.x = Math.max(d1.x, d2.x);
d1.y = Math.min(d1.y, d2.y);
d2.y = Math.max(d1.y, d2.y);
let ll_x = Math.floor(dx1 * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ur_x = Math.floor(dx2 * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ur_y = Math.floor((dy1 + this.y_low_offs) * this.ctx.mw.zoom_factor_y) -
let ll_x = Math.floor(d1.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ur_x = Math.floor(d2.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ur_y = Math.floor((d1.y + this.y_low_offs) * this.ctx.mw.zoom_factor_y) -
this.ctx.mw.offset_y;
let ll_y = Math.floor(dy1 * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let ll_y = Math.floor(d1.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let drawtype =
GlowColor.get_drawtype(this.draw_type, DrawType.LineHighlight,
......
......@@ -137,14 +137,14 @@ class GrowImage extends Rect {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = Math.floor(this.trf.x(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let ll_x = Math.min(x1, x2);
let ur_x = Math.max(x1, x2);
......@@ -155,12 +155,12 @@ class GrowImage extends Rect {
}
get_borders(t, g) {
let x1 = this.trf.x(t, this.ll.x, this.ll.y);
let x2 = this.trf.x(t, this.ur.x, this.ur.y);
let y1 = this.trf.y(t, this.ll.x, this.ll.y);
let y2 = this.trf.y(t, this.ur.x, this.ur.y);
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
g.set(Rect.union(g, new Rect(Math.min(x1, x2), Math.min(y1, y2), Math.max(x1, x2), Math.max(y1, y2))));
g.set(Rect.union(g, new Rect(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y),
Math.max(p1.x, p2.x), Math.max(p1.y, p2.y))));
}
get_node_borders() {
......@@ -206,7 +206,8 @@ class GrowImage extends Rect {
let old_x_right = this.ur_x;
let old_y_low = this.ll_y;
let old_y_high = this.ur_y;
this.trf.scale_from_stored(scale_x, scale_y, x0, y0);
this.trf.revert();
this.trf.scale(scale_x, scale_y, x0, y0);
this.get_node_borders();
switch (type) {
......
......@@ -96,14 +96,14 @@ class GrowLine extends GlowLine {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = Math.floor(this.trf.x(t, this.p1.x, this.p1.y) *
this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.p1.x, this.p1.y) *
this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(t, this.p2.x, this.p2.y) *
this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(t, this.p2.x, this.p2.y) *
this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.p1);
let p2 = tmp.apply(this.p2);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
if (x1 === x2 && y1 === y2) {
return;
......
......@@ -46,18 +46,14 @@ class GrowMenu extends GrowRect {
if (this.ctx.nodraw !== 0) {
return;
}
let text_idx = Math.floor(this.trf.vertical_scale(t) *
this.ctx.mw.zoom_factor_y / this.ctx.mw.base_zoom_factor *
(this.text_size + 4) - 4);
let tsize = this.trf.vertical_scale(t) * this.ctx.mw.zoom_factor_y /
this.ctx.mw.base_zoom_factor * (8 + 2 * this.text_size);
text_idx = Math.min(text_idx, DRAW_TYPE_SIZE - 1);
text_idx = Math.max(0, text_idx);
let tsize = Matrix.multiply(this.trf, t).vertical_scale() *
this.ctx.mw.zoom_factor_y / this.ctx.mw.base_zoom_factor * (this.text_size + 4);
let text_idx = clamp(Math.floor(tsize - 4), 0, DRAW_TYPE_SIZE - 1);
tsize *= 2;
let idx = Math.floor(this.ctx.mw.zoom_factor_y / this.ctx.mw.base_zoom_factor *
this.line_width - 1);
idx += hot;
idx = clamp(idx, 0, DRAW_TYPE_SIZE-1);
idx = clamp(idx + hot, 0, DRAW_TYPE_SIZE-1);
let z_width, z_descent;
let z_height = 0;
......@@ -118,7 +114,7 @@ class GrowMenu extends GrowRect {
Math.floor(this.ll.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
this.get_node_borders();
if (this.fill !== 0) {
if (this.fill) {
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
this.fill_drawtype, true, 0);
}
......@@ -176,7 +172,7 @@ class GrowMenu extends GrowRect {
let ur_y = Math.max(this.ll.y, this.ur.y);
if (ll_x <= x && x <= ur_x && ll_y <= y && y <= ur_y) {
let vscale = this.trf.vertical_scale(null);
let vscale = this.trf.vertical_scale();
let item = Math.floor((y - this.ll.y) /
(this.item_height / vscale / this.ctx.mw.zoom_factor_y));
......
......@@ -213,7 +213,7 @@ class GrowNode extends GlowNode {
if (t === null) {
this.nc.draw(this.trf, highlight, hot, node, node);
} else {
let trf_tot = GlowTransform.multiply(t, this.trf);
let trf_tot = Matrix.multiply(t, this.trf);
this.nc.draw(trf_tot, highlight, hot, this, this);
}
} else {
......@@ -291,7 +291,7 @@ class GrowNode extends GlowNode {
if (t === null) {
this.nc.draw(this.trf, highlight, hot, node, node);
} else {
let trf_tot = GlowTransform.multiply(t, this.trf);
let trf_tot = Matrix.multiply(t, this.trf);
// If this node has a trace pointer, use colors for this node
this.nc.draw(trf_tot, highlight, hot, this, this);
}
......@@ -351,7 +351,7 @@ class GrowNode extends GlowNode {
if (t === null) {
this.nc.draw(this.trf, highlight, hot, node, node);
} else {
let trf_tot = GlowTransform.multiply(t, this.trf);
let trf_tot = Matrix.multiply(t, this.trf);
// If this node has a trace pointer, use colors for this node
this.nc.draw(trf_tot, highlight, hot, this, this);
}
......@@ -466,7 +466,8 @@ class GrowNode extends GlowNode {
old_x_right = this.ur_x;
old_y_low = this.ll_y;
old_y_high = this.ur_y;
this.trf.scale_from_stored(scale_x, scale_y, x0, y0);
this.trf.revert();
this.trf.scale(scale_x, scale_y, x0, y0);
this.get_node_borders();
this.ctx.draw();
......@@ -510,7 +511,7 @@ class GrowNode extends GlowNode {
let t = new GlowTransform();
t.rotate(angel, x0, y0);
this.trf.set_from_stored(t);
this.trf.set(Matrix.multiply(t, this.trf.s));
this.get_node_borders();
}
......@@ -600,29 +601,27 @@ class GrowNode extends GlowNode {
}
// Calculate max and min coordinates
let x1 = this.trf.x(0, this.nc.y0);
let y1 = this.trf.y(0, this.nc.y0);
let x2 = this.trf.x(0, this.nc.y1);
let y2 = this.trf.y(0, this.nc.y1);
let p1 = this.trf.apply(new Point(0, this.nc.y0));
let p2 = this.trf.apply(new Point(0, this.nc.y1));
let rotation = (this.trf.rot() / 360 - Math.floor(this.trf.rot() / 360)) * 360;
let rotation = (this.trf.rotation / 360 - Math.floor(this.trf.rotation / 360)) * 360;
if (rotation <= 45 || rotation > 315) {
limits.direction = Direction.Down;
limits.min = y1;
limits.max = y2;
limits.min = p1.y;
limits.max = p2.y;
} else if (rotation > 45 && rotation <= 135) {
limits.direction = Direction.Right;
limits.min = x2;
limits.max = x1;
limits.min = p2.x;
limits.max = p1.x;
} else if (rotation > 135 && rotation <= 225) {
limits.direction = Direction.Up;
limits.min = y2;
limits.max = y1;
limits.min = p2.y;
limits.max = p1.y;
} else if (rotation > 225 && rotation <= 315) {
limits.direction = Direction.Left;
limits.min = x1;
limits.max = x2;
limits.min = p1.x;
limits.max = p2.x;
}
limits.status = 1;
return limits;
......@@ -635,7 +634,7 @@ class GrowNode extends GlowNode {
}
get_borders(t, g) {
let t2 = (t) ? GlowTransform.multiply(t, this.trf) : this.trf;
let t2 = (t) ? Matrix.multiply(t, this.trf) : this.trf;
this.nc.get_borders(t2, g);
}
......@@ -655,30 +654,28 @@ class GrowNode extends GlowNode {
this.get_borders(t, g);
if (g.hit(new Point(x, y))) {
// Hit, calculate max and min koordinates
let x1 = this.trf.x(t, 0, this.nc.y0);
let y1 = this.trf.y(t, 0, this.nc.y0);
let x2 = this.trf.x(t, 0, this.nc.y1);
let y2 = this.trf.y(t, 0, this.nc.y1);
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(new Point(0, this.nc.y0));
let p2 = tmp.apply(new Point(0, this.nc.y1));
let rotation =
(this.trf.rot(t) / 360 - Math.floor(this.trf.rot(t) / 360)) * 360;
let rotation = (tmp.rotation / 360 - Math.floor(tmp.rotation / 360)) * 360;
if (rotation <= 45 || rotation > 315) {
b.direction = Direction.Down;
b.min = y1;
b.max = y2;
b.min = p1.y;
b.max = p2.y;
} else if (rotation > 45 && rotation <= 135) {
b.direction = Direction.Left;
b.min = x2;
b.max = x1;
b.min = p2.x;
b.max = p1.x;
} else if (rotation > 135 && rotation <= 225) {
b.direction = Direction.Up;
b.min = y2;
b.max = y1;
b.min = p2.y;
b.max = p1.y;
} else if (rotation > 225 && rotation <= 315) {
b.direction = Direction.Right;
b.min = x1;
b.max = x2;
b.min = p1.x;
b.max = p2.x;
}
b.background = this;
......
......@@ -158,15 +158,17 @@ class GrowPie extends GrowArc {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = Math.floor(this.trf.x(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let rot = Math.floor(this.trf.rot(t));
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let rot = t ? this.trf.rotation + t.rotation : this.trf.rotation;
rot = Math.floor(rot);
let ll_x = Math.min(x1, x2);
let ur_x = Math.max(x1, x2);
......
......@@ -290,7 +290,7 @@ class GrowPolyline extends GlowPolyline {
this.ctx.gdraw.polyline(this.points, this.a_points.size(),
drawtype, true, 0);
} else {
let rotation = t ? this.trf.rot(t) : this.trf.rot();
let rotation = t ? this.trf.rotation + t.rotation : this.trf.rotation;
let f1, f2;
if (this.gradient_contrast >= 0) {
......@@ -314,7 +314,7 @@ class GrowPolyline extends GlowPolyline {
0 && this.fill_eq_shadow === 0;
if (display_shadow && this.shadow_width !== 0) {
let trf_scale = this.trf.vertical_scale(t);
let trf_scale = Matrix.multiply(this.trf, t).vertical_scale();
let ish = Math.floor(this.shadow_width / 100 * trf_scale *
Math.min((this.ur_x - this.ll_x) * this.ctx.mw.zoom_factor_x,
(this.ur_y - this.ll_y) * this.ctx.mw.zoom_factor_y) + 0.5);
......@@ -587,19 +587,18 @@ class GrowPolyline extends GlowPolyline {
}
get_borders(t, g) {
let x2 = 0, y2 = 0;
let tmp = Matrix.multiply(this.trf, t);
let p2 = new Point();
for (let i = 0; i < this.a_points.size() - 1; i++) {
let e = this.a_points.get(i);
let x1 = x2;
let y1 = y2;
let p1 = new Point(p2.x, p2.y);
if (i === 0) {
x1 = this.trf.x(t, e.x, e.y);
y1 = this.trf.y(t, e.x, e.y);
p1 = tmp.apply(e);
}
x2 = this.trf.x(t, e.x, e.y);
y2 = this.trf.y(t, e.x, e.y);
p2 = tmp.apply(e);
g.set(Rect.union(g, new Rect(Math.min(x1, x2), Math.min(y1, y2), Math.max(x1, x2), Math.max(y1, y2))));
g.set(Rect.union(g, new Rect(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y),
Math.max(p1.x, p2.x), Math.max(p1.y, p2.y))));
}
}
......
......@@ -172,14 +172,14 @@ class GrowRect extends GlowRect {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = this.trf.x(t, this.ll.x, this.ll.y) * this.ctx.mw.zoom_factor_x +
0.5 - this.ctx.mw.offset_x;
let y1 = this.trf.y(t, this.ll.x, this.ll.y) * this.ctx.mw.zoom_factor_y +
0.5 - this.ctx.mw.offset_y;
let x2 = this.trf.x(t, this.ur.x, this.ur.y) * this.ctx.mw.zoom_factor_x +
0.5 - this.ctx.mw.offset_x;
let y2 = this.trf.y(t, this.ur.x, this.ur.y) * this.ctx.mw.zoom_factor_y +
0.5 - this.ctx.mw.offset_y;
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
let x1 = p1.x * this.ctx.mw.zoom_factor_x + 0.5 - this.ctx.mw.offset_x;
let y1 = p1.y * this.ctx.mw.zoom_factor_y + 0.5 - this.ctx.mw.offset_y;
let x2 = p2.x * this.ctx.mw.zoom_factor_x + 0.5 - this.ctx.mw.offset_x;
let y2 = p2.y * this.ctx.mw.zoom_factor_y + 0.5 - this.ctx.mw.offset_y;
let ll_x = Math.min(x1, x2);
let ur_x = Math.max(x1, x2);
......@@ -239,14 +239,14 @@ class GrowRect extends GlowRect {
];
this.ctx.gdraw.polyline(points, 7, drawtype, true, 0);
}
if (this.fill !== 0) {
if (this.fill) {
if (display_shadow && ish !== 0) {
if (grad === Gradient.No || fillcolor === DrawType.ColorRed) {
let drawtype = (chot === 0) ? fillcolor : GlowColor.shift_drawtype(fillcolor, chot, null);
this.ctx.gdraw.rect(ll_x + ish, ll_y + ish, ur_x - ll_x - 2 *
ish, ur_y - ll_y - 2 * ish, drawtype, true, 0);
} else {
let rotationa = t ? this.trf.rot(t) : this.trf.rot();
let rotationa = t ? this.trf.rotation + t.rotation : this.trf.rotation;
let fa0, fa1, fa2;
if (this.bgcolor_gradient !== 0 &&
......@@ -281,7 +281,7 @@ class GrowRect extends GlowRect {
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
drawtype, true, 0);
} else {
let rotationb = t ? this.trf.rot(t) : this.trf.rot();
let rotationb = t ? this.trf.rotation + t.rotation : this.trf.rotation;
let fb0, fb1, fb2;
if (this.bgcolor_gradient !== 0 &&
......@@ -313,7 +313,7 @@ class GrowRect extends GlowRect {
}
}
if (this.border !== 0 ||
!(this.fill !== 0 || (display_shadow && this.shadow_width !== 0))) {
!(this.fill || (display_shadow && this.shadow_width !== 0))) {
let drawtype =
GlowColor.get_drawtype(this.draw_type, DrawType.LineHighlight,
highlight, colornode, 0, 0);
......@@ -322,12 +322,12 @@ class GrowRect extends GlowRect {
}
get_borders(t, g) {
let x1 = this.trf.x(t, this.ll.x, this.ll.y);
let x2 = this.trf.x(t, this.ur.x, this.ur.y);
let y1 = this.trf.y(t, this.ll.x, this.ll.y);
let y2 = this.trf.y(t, this.ur.x, this.ur.y);
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
g.set(Rect.union(g, new Rect(Math.min(x1, x2), Math.min(y1, y2), Math.max(x1, x2), Math.max(y1, y2))));
g.set(Rect.union(g, new Rect(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y),
Math.max(p1.x, p2.x), Math.max(p1.y, p2.y))));
}
get_node_borders() {
......@@ -376,7 +376,8 @@ class GrowRect extends GlowRect {
let old_x_right = this.ur_x;
let old_y_low = this.ll_y;
let old_y_high = this.ur_y;
this.trf.scale_from_stored(scale_x, scale_y, x0, y0);
this.trf.revert();
this.trf.scale(scale_x, scale_y, x0, y0);
this.get_node_borders();
switch (type) {
......
......@@ -120,14 +120,14 @@ class GrowRectRounded extends GrowRect {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = Math.floor(this.trf.x(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let ll_x = Math.min(x1, x2);
let ur_x = Math.max(x1, x2);
......@@ -135,7 +135,7 @@ class GrowRectRounded extends GrowRect {
let ur_y = Math.max(y1, y2);
let amount = Math.floor(this.round_amount / 100 *
Math.min(ur_x - ll_x, ur_y - ll_y) + 0.5);
if (this.fill !== 0) {
if (this.fill) {
let ish = Math.floor(this.shadow_width / 100 *
Math.min(ur_x - ll_x, ur_y - ll_y) + 0.5);
let display_shadow = ((node !== null && node.shadow !== 0) ||
......@@ -169,7 +169,7 @@ class GrowRectRounded extends GrowRect {
this.ctx.gdraw.arc(ur_x - 2 * amount, ll_y, 2 * amount, 2 *
amount, 0, 90, drawtype, true, 0);
} else {
let rotationa = t ? this.trf.rot(t) : this.trf.rot();
let rotationa = t ? this.trf.rotation + t.rotation : this.trf.rotation;
let fa1, fa2;
if (this.gradient_contrast >= 0) {
......@@ -244,7 +244,7 @@ class GrowRectRounded extends GrowRect {
2 * amount, ur_y - ll_y - 2 * amount, drawtype, true, 0);
}
} else {
let rotationb = t ? this.trf.rot(t) : this.trf.rot();
let rotationb = t ? this.trf.rotation + t.rotation : this.trf.rotation;
let fb1, fb2;
if (this.gradient_contrast >= 0) {
......@@ -268,7 +268,7 @@ class GrowRectRounded extends GrowRect {
}
}
}
if (this.border !== 0 || this.fill === 0) {
if (this.border !== 0 || !this.fill) {
let drawtype =
GlowColor.get_drawtype(this.draw_type, DrawType.LineHighlight,
highlight, colornode, 0, 0);
......
......@@ -22,7 +22,7 @@ class GrowScrollBar extends GrowRect {
this.ur.y = y + h;
this.draw_type = border_d_type;
this.line_width = line_width;
this.fill = 1;
this.fill = true;
this.border = 1;
this.shadow = 0;
this.fill_drawtype = fill_d_type;
......@@ -48,14 +48,14 @@ class GrowScrollBar extends GrowRect {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = Math.floor(this.trf.x(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let ll_x = Math.min(x1, x2);
let ur_x = Math.max(x1, x2);
......
......@@ -391,22 +391,21 @@ class GrowTable extends GrowRect {
let header_tsize = this.ctx.mw.zoom_factor_y /
this.ctx.mw.base_zoom_factor * (8 + 2 * this.header_text_size);
let dx1 = this.trf.x(t, this.ll.x, this.ll.y);
let dy1 = this.trf.y(t, this.ll.x, this.ll.y);
let dx2 = this.trf.x(t, this.ur.x, this.ur.y);
let dy2 = this.trf.y(t, this.ur.x, this.ur.y);
dx1 = Math.min(dx1, dx2);
dx2 = Math.max(dx1, dx2);
dy1 = Math.min(dy1, dy2);
dy2 = Math.max(dy1, dy2);
let tmp = Matrix.multiply(this.trf, t);
let d1 = tmp.apply(this.ll);
let d2 = tmp.apply(this.ur);
d1.x = Math.min(d1.x, d2.x);
d2.x = Math.max(d1.x, d2.x);
d1.y = Math.min(d1.y, d2.y);
d2.y = Math.max(d1.y, d2.y);
if (this.v_scrollbar !== null) {
if (this.h_scrollbar === null) {
this.v_scrollbar.set_position(dx2 - this.scrollbar_width, dy1 +
this.y_low_offs, this.scrollbar_width, dy2 - (dy1 + this.y_low_offs));
this.v_scrollbar.set_position(d2.x - this.scrollbar_width, d1.y +
this.y_low_offs, this.scrollbar_width, d2.y - (d1.y + this.y_low_offs));
} else {
this.v_scrollbar.set_position(dx2 - this.scrollbar_width, dy1 +
this.y_low_offs, this.scrollbar_width, dy2 - (dy1 + this.y_low_offs) -
this.v_scrollbar.set_position(d2.x - this.scrollbar_width, d1.y +
this.y_low_offs, this.scrollbar_width, d2.y - (d1.y + this.y_low_offs) -
this.scrollbar_width);
}
this.v_scrollbar.draw();
......@@ -414,12 +413,12 @@ class GrowTable extends GrowRect {
}
if (this.h_scrollbar !== null) {
if (this.v_scrollbar === null) {
this.h_scrollbar.set_position(dx1 + this.x_left_offs, dy2 -
this.scrollbar_width, dx2 - (dx1 + this.x_left_offs),
this.h_scrollbar.set_position(d1.x + this.x_left_offs, d2.y -
this.scrollbar_width, d2.x - (d1.x + this.x_left_offs),
this.scrollbar_width);
} else {
this.h_scrollbar.set_position(dx1 + this.x_left_offs, dy2 -
this.scrollbar_width, dx2 - (dx1 + this.x_left_offs) -
this.h_scrollbar.set_position(d1.x + this.x_left_offs, d2.y -
this.scrollbar_width, d2.x - (d1.x + this.x_left_offs) -
this.scrollbar_width, this.scrollbar_width);
}
this.h_scrollbar.draw();
......@@ -433,18 +432,18 @@ class GrowTable extends GrowRect {
let light_drawtype = GlowColor.shift_drawtype(this.fill_drawtype, -2, null);
let sel_drawtype = (this.select_drawtype === DrawType.Inherit) ? dark_drawtype : this.select_drawtype;
let ll_x = Math.floor(dx1 * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ll_y = Math.floor(dy1 * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let ur_x = Math.floor(dx2 * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ur_y = Math.floor(dy2 * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let ll_x = Math.floor(d1.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ll_y = Math.floor(d1.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let ur_x = Math.floor(d2.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ur_y = Math.floor(d2.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let o_ll_x = Math.floor((dx1 + this.x_left_offs) *
let o_ll_x = Math.floor((d1.x + this.x_left_offs) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let o_ll_y = Math.floor((dy1 + this.y_low_offs) *
let o_ll_y = Math.floor((d1.y + this.y_low_offs) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let o_ur_x = Math.floor((dx2 - this.vertical_scrollbar *
let o_ur_x = Math.floor((d2.x - this.vertical_scrollbar *
this.scrollbar_width) * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let o_ur_y = Math.floor((dy2 - this.horizontal_scrollbar *
let o_ur_y = Math.floor((d2.y - this.horizontal_scrollbar *
this.scrollbar_width) * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let t_ll_x = o_ll_x - Math.floor(this.h_value * this.ctx.mw.zoom_factor_x);
......@@ -464,7 +463,7 @@ class GrowTable extends GrowRect {
}
if (this.header_row !== 0) {
if (this.fill !== 0) {
if (this.fill) {
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, header_h,
this.fill_drawtype, true, 0);
}
......@@ -549,7 +548,7 @@ class GrowTable extends GrowRect {
}
if (this.header_column !== 0) {
if (this.fill !== 0) {
if (this.fill) {
this.ctx.gdraw.rect(ll_x, ll_y + header_h, header_w, ur_y - ll_y -
header_h, this.fill_drawtype, true, 0);
}
......@@ -639,7 +638,7 @@ class GrowTable extends GrowRect {
}
// Draw table
if (this.fill !== 0) {
if (this.fill) {
this.ctx.gdraw.rect(o_ll_x, o_ll_y, o_ur_x - o_ll_x, o_ur_y - o_ll_y,
this.fill_drawtype, true, 0);
}
......
......@@ -85,7 +85,7 @@ class GrowText extends GlowText {
}
let z_descent;
let trf_scale = this.trf.vertical_scale(t);
let trf_scale = Matrix.multiply(this.trf, t).vertical_scale();
let idx = Math.floor(trf_scale * this.ctx.mw.zoom_factor_y /
this.ctx.mw.base_zoom_factor * (this.text_size + 4) - 3);
let tsize = trf_scale * this.ctx.mw.zoom_factor_y /
......@@ -110,9 +110,12 @@ class GrowText extends GlowText {
let ry1 = 0;
let z_width = 0;
let z_height = 0;
let x1 = Math.floor(this.trf.x(t, this.p.x, this.p.y) * this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.p.x, this.p.y) * this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let rot = Math.floor(this.trf.rot(t));
let tmp = Matrix.multiply(this.trf, t);
let p = tmp.apply(this.p);
let x1 = Math.floor(p.x * this.ctx.mw.zoom_factor_x + 0.5) - this.ctx.mw.offset_x;
let y1 = Math.floor(p.y * this.ctx.mw.zoom_factor_y + 0.5) - this.ctx.mw.offset_y;
let rot = t ? this.trf.rotation + t.rotation : this.trf.rotation;
rot = Math.floor(rot);
if (this.adjustment === Adjustment.Center) {
rot = rot < 0 ? rot % 360 + 360 : rot % 360;
} else {
......
......@@ -157,21 +157,21 @@ class GrowTrend extends GrowRect {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let x1 = Math.floor(this.trf.x(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(this.trf.y(t, this.ll.x, this.ll.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(this.trf.x(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(this.trf.y(t, this.ur.x, this.ur.y) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let tmp = Matrix.multiply(this.trf, t);
let p1 = tmp.apply(this.ll);
let p2 = tmp.apply(this.ur);
let x1 = Math.floor(p1.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y1 = Math.floor(p1.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let x2 = Math.floor(p2.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let y2 = Math.floor(p2.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let ll_x = Math.min(x1, x2);
let ur_x = Math.max(x1, x2);
let ll_y = Math.min(y1, y2);
let ur_y = Math.max(y1, y2);
if (this.fill !== 0) {
if (this.fill) {
let grad = this.gradient;
if (this.gradient === Gradient.No &&
(node !== null && node.gradient !== Gradient.No) &&
......@@ -186,7 +186,7 @@ class GrowTrend extends GrowRect {
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
drawtype, true, 0);
} else {
let rotation = t ? this.trf.rot(t) : this.trf.rot();
let rotation = t ? this.trf.rotation + t.rotation : this.trf.rotation;
let f1, f2;
if (this.gradient_contrast >= 0) {
......@@ -211,10 +211,8 @@ class GrowTrend extends GrowRect {
let curvetmp = this.curve.slice(0, this.curve_cnt).filter(e => e !== null);
if (this.fill_curve !== 0) {
let tmp1 = t ? GlowTransform.multiply(t, this.trf) : this.trf;
curvetmp.forEach(e => e.border = 0);
curvetmp.forEach(e => e.draw(tmp1, highlight, hot, node, colornode));
curvetmp.forEach(e => e.draw(Matrix.multiply(t, this.trf), highlight, hot, node, colornode));
curvetmp.forEach(e => e.border = 1);
}
......@@ -233,15 +231,16 @@ class GrowTrend extends GrowRect {
if (this.fill_curve !== 0) {
curvetmp.forEach(e => e.fill = 0);
}
let tmp2 = t ? GlowTransform.multiply(t, this.trf) : this.trf;
curvetmp.forEach(e => e.draw(tmp2, highlight, hot, node, colornode));
curvetmp.forEach(e => e.draw(Matrix.multiply(t, this.trf), highlight, hot, node, colornode));
if (this.fill_curve !== 0) {
curvetmp.forEach(e => e.fill = 1);
}
let tmp = Matrix.multiply(this.trf, t);
if (this.display_x_mark1 !== 0) {
let xm1 = Math.floor(this.trf.x(t, this.x_mark1, this.ll.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let p = tmp.apply(new Point(this.x_mark1, this.ll.y));
let xm1 = Math.floor(p.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
if (xm1 >= ll_x && xm1 <= ur_x) {
drawtype = this.mark1_color;
if (drawtype === DrawType.Inherit) {
......@@ -251,8 +250,8 @@ class GrowTrend extends GrowRect {
}
}
if (this.display_x_mark2 !== 0) {
let xm2 = Math.floor(this.trf.x(t, this.x_mark2, this.ll.y) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let p = tmp.apply(new Point(this.x_mark2, this.ll.y));
let xm2 = Math.floor(p.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
if (xm2 >= ll_x && xm2 <= ur_x) {
drawtype = this.mark2_color;
if (drawtype === DrawType.Inherit) {
......@@ -262,14 +261,8 @@ class GrowTrend extends GrowRect {
}
}
if (this.display_y_mark1 !== 0) {
let ym1;
if (t === null) {
ym1 = Math.floor(this.trf.y(this.ll.x, this.y_mark1) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
} else {
ym1 = Math.floor(this.trf.y(t, this.ll.x, this.y_mark1) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
}
let p = tmp.apply(new Point(this.ll.x, this.y_mark1));
let ym1 = Math.floor(p.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
if (ym1 >= ll_y && ym1 <= ur_y) {
drawtype = this.mark1_color;
if (drawtype === DrawType.Inherit) {
......@@ -279,14 +272,8 @@ class GrowTrend extends GrowRect {
}
}
if (this.display_y_mark2 !== 0) {
let ym2;
if (t === null) {
ym2 = Math.floor(this.trf.y(this.ll.x, this.y_mark2) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
} else {
ym2 = Math.floor(this.trf.y(t, this.ll.x, this.y_mark2) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
}
let p = tmp.apply(new Point(this.ll.x, this.y_mark2));
let ym2 = Math.floor(p.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
if (ym2 >= ll_y && ym2 <= ur_y) {
drawtype = this.mark2_color;
if (drawtype === DrawType.Inherit) {
......
......@@ -117,46 +117,45 @@ class GrowWindow extends GrowRect {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
let dx1 = this.trf.x(t, this.ll.x, this.ll.y);
let dy1 = this.trf.y(t, this.ll.x, this.ll.y);
let dx2 = this.trf.x(t, this.ur.x, this.ur.y);
let dy2 = this.trf.y(t, this.ur.x, this.ur.y);
dx1 = Math.min(dx1, dx2);
dx2 = Math.max(dx1, dx2);
dy1 = Math.min(dy1, dy2);
dy2 = Math.max(dy1, dy2);
let tmp = Matrix.multiply(this.trf, t);
let d1 = tmp.apply(this.ll);
let d2 = tmp.apply(this.ur);
d1.x = Math.min(d1.x, d2.x);
d2.x = Math.max(d1.x, d2.x);
d1.y = Math.min(d1.y, d2.y);
d2.y = Math.max(d1.y, d2.y);
if (this.v_scrollbar !== null) {
if (this.h_scrollbar === null) {
this.v_scrollbar.set_position(dx2 - this.scrollbar_width, dy1 +
this.y_low_offs, this.scrollbar_width, dy2 - (dy1 + this.y_low_offs));
this.v_scrollbar.set_position(d2.x - this.scrollbar_width, d1.y +
this.y_low_offs, this.scrollbar_width, d2.y - (d1.y + this.y_low_offs));
} else {
this.v_scrollbar.set_position(dx2 - this.scrollbar_width, dy1 +
this.y_low_offs, this.scrollbar_width, dy2 - (dy1 + this.y_low_offs) -
this.v_scrollbar.set_position(d2.x - this.scrollbar_width, d1.y +
this.y_low_offs, this.scrollbar_width, d2.y - (d1.y + this.y_low_offs) -
this.scrollbar_width);
}
this.v_scrollbar.draw(null, 0, 0, null, null);
}
if (this.h_scrollbar !== null) {
if (this.v_scrollbar === null) {
this.h_scrollbar.set_position(dx1, dy2 - this.scrollbar_width, dx2 -
dx1, this.scrollbar_width);
this.h_scrollbar.set_position(d1.x, d2.y - this.scrollbar_width, d2.x -
d1.x, this.scrollbar_width);
} else {
this.h_scrollbar.set_position(dx1, dy2 - this.scrollbar_width, dx2 -
dx1 - this.scrollbar_width, this.scrollbar_width);
this.h_scrollbar.set_position(d1.x, d2.y - this.scrollbar_width, d2.x -
d1.x - this.scrollbar_width, this.scrollbar_width);
}
this.h_scrollbar.draw(null, 0, 0, null, null);
}
let ll_x = Math.floor(dx1 * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ll_y = Math.floor((dy1 + this.y_low_offs) * this.ctx.mw.zoom_factor_y) -
let ll_x = Math.floor(d1.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ll_y = Math.floor((d1.y + this.y_low_offs) * this.ctx.mw.zoom_factor_y) -
this.ctx.mw.offset_y;
if (this.windowCtx !== null) {
let ur_x = Math.floor((dx2 - this.vertical_scrollbar * this.scrollbar_width) *
let ur_x = Math.floor((d2.x - this.vertical_scrollbar * this.scrollbar_width) *
this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ur_y =
Math.floor((dy2 - this.horizontal_scrollbar * this.scrollbar_width) *
Math.floor((d2.y - this.horizontal_scrollbar * this.scrollbar_width) *
this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
this.windowCtx.mw.window_width =
......@@ -179,7 +178,7 @@ class GrowWindow extends GrowRect {
this.windowCtx.mw.subwindow_scale * this.ctx.mw.zoom_factor_y;
// window_ctx->draw_buffer_only = ctx->draw_buffer_only;
if (this.fill !== 0) {
if (this.fill) {
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
this.fill_drawtype, true, 0);
}
......@@ -197,8 +196,8 @@ class GrowWindow extends GrowRect {
this.ctx.gdraw.reset_clip_rectangle();
}
let ur_x = Math.floor(dx2 * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ur_y = Math.floor(dy2 * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let ur_x = Math.floor(d2.x * this.ctx.mw.zoom_factor_x) - this.ctx.mw.offset_x;
let ur_y = Math.floor(d2.y * this.ctx.mw.zoom_factor_y) - this.ctx.mw.offset_y;
let drawtype =
GlowColor.get_drawtype(this.draw_type, DrawType.LineHighlight,
......@@ -253,7 +252,7 @@ class GrowWindow extends GrowRect {
if (this.windowCtx.background_color !== DrawType.Inherit) {
this.fill_drawtype = this.windowCtx.background_color;
this.original_fill_drawtype = this.fill_drawtype;
this.fill = 1;
this.fill = true;
}
if (this.windowCtx.x0 !== this.windowCtx.x1 &&
this.windowCtx.y0 !== this.windowCtx.y1) {
......@@ -547,7 +546,7 @@ class GrowWindow extends GrowRect {
}
this.fill_drawtype = DrawType.Inherit;
this.original_fill_drawtype = this.fill_drawtype;
this.fill = 0;
this.fill = false;
}
this.file_name = this.input_file_name;
this.new_ctx();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment