Commit 864116f0 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Web: Merged FlowDraw/GlowDraw/PlowDraw.

parent 877cd1a5
......@@ -691,20 +691,6 @@ class PlowRect {
}
}
class GDraw {
ctx: PlowCtx;
canvas: HTMLCanvasElement;
gctx: CanvasRenderingContext2D;
offset_top: number;
constructor(ctx) {
this.ctx = ctx;
this.canvas = document.querySelector("canvas");
this.gctx = this.canvas.getContext("2d");
this.offset_top = this.canvas.offsetTop;
}
}
class PlowCtx {
gdh: Gdh = null;
nodraw = 0;
......@@ -716,7 +702,7 @@ class PlowCtx {
a: PlowArray;
a_nc: PlowArray;
name = "Claes context";
gdraw: GDraw;
gdraw: Draw;
select_object: PlowNode = null;
event_cb: (event: object, object: PlowNode, x: number, y: number) => void = null;
event_object: PlowNode = null;
......@@ -724,7 +710,7 @@ class PlowCtx {
constructor() {
this.a = new PlowArray(this);
this.a_nc = new PlowArray(this);
this.gdraw = new GDraw(this);
this.gdraw = new Draw(this);
this.rect = new Rect();
}
......
......@@ -46,10 +46,11 @@
</div>
<canvas id="flowcanvas" width="1200" height="800"></canvas>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="pwr.js"></script>
<script type="text/babel" src="cli.js"></script>
<script type="text/babel" src="gdh.js"></script>
<script type="text/babel" src="plow.js"></script>
<script type="text/babel" src="pwr.ts"></script>
<script type="text/babel" src="cli.ts"></script>
<script type="text/babel" src="gdh.ts"></script>
<script type="text/babel" src="draw.ts"></script>
<script type="text/babel" src="plow.ts"></script>
<script type="text/babel" src="ev.ts"></script>
<hr>
<address><a href="mailto:claes@debian86.ssab.com"></a></address>
......
......@@ -579,13 +579,13 @@ class Ev {
case Event.Key_CtrlL:
let o = this.ctx.get_select();
if (o.userdata instanceof EvItemAlarm) {
this.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC).then(this.open_plc_cb);
this.ctx.gdh.getObjectFromAref(o.userdata.e.supObject, GdhOp.GET_OP_METHOD_PLC).then(this.open_plc_cb);
}
break;
case Event.Key_CtrlG:
let o = this.ctx.get_select();
if (o.userdata instanceof EvItemAlarm) {
this.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC).then(this.open_objectgraph_cb);
this.ctx.gdh.getObjectFromAref(o.userdata.e.supObject, GdhOp.GET_OP_METHOD_PLC).then(this.open_objectgraph_cb);
}
break;
default:
......
......@@ -22,8 +22,9 @@
</div>
<canvas id="flowcanvas" width="1200" height="800"></canvas>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="pwr.js"></script>
<script type="text/babel" src="gdh.js"></script>
<script type="text/babel" src="pwr.ts"></script>
<script type="text/babel" src="gdh.ts"></script>
<script type="text/babel" src="draw.ts"></script>
<script type="text/babel" src="flow.ts"></script>
<hr>
<address><a href="mailto:claes@debian86.ssab.com"></a></address>
......
......@@ -214,34 +214,6 @@ enum Save {
Triangle_rect_part = 2000
}
class GDraw {
ctx: FlowCtx;
canvas: HTMLCanvasElement;
gctx: CanvasRenderingContext2D;
offset_top: number;
offset_left: number;
constructor(ctx: FlowCtx) {
this.ctx = ctx;
this.canvas = document.querySelector("canvas");
this.gctx = this.canvas.getContext("2d");
this.offset_top = this.canvas.offsetTop;
this.offset_left = this.canvas.offsetTop;
console.log("offset_top", this.offset_top, "offset_left", this.offset_left);
}
rect(x, y, width, height) {
this.gctx.strokeRect(x, y, width, height);
}
line(x1, y1, x2, y2) {
this.gctx.beginPath();
this.gctx.moveTo(x1, y1);
this.gctx.lineTo(x2, y2);
this.gctx.stroke();
}
}
class FlowArray {
ctx: FlowCtx;
a = [];
......@@ -1548,7 +1520,7 @@ class FlowCtx extends Rect {
a: FlowArray;
a_nc: FlowArray;
a_cc: FlowArray;
gdraw: GDraw;
gdraw: Draw;
display_level = DisplayLevel.One;
gdh: Gdh = null;
zoom_factor = 20.0;
......@@ -1563,7 +1535,7 @@ class FlowCtx extends Rect {
this.a = new FlowArray(this);
this.a_nc = new FlowArray(this);
this.a_cc = new FlowArray(this);
this.gdraw = new GDraw(this);
this.gdraw = new Draw(this);
}
draw() {
......
......@@ -8,9 +8,10 @@
<body>
<canvas id="flowcanvas" width="1200" height="800"></canvas>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="pwr.js"></script>
<script type="text/babel" src="cli.js"></script>
<script type="text/babel" src="gdh.js"></script>
<script type="text/babel" src="pwr.ts"></script>
<script type="text/babel" src="cli.ts"></script>
<script type="text/babel" src="gdh.ts"></script>
<script type="text/babel" src="draw.ts"></script>
<script type="text/babel" src="glow.ts"></script>
<script type="text/babel" src="glow_color.ts"></script>
......@@ -25,7 +26,6 @@
<script type="text/babel" src="glow_con.ts"></script>
<script type="text/babel" src="glow_conclass.ts"></script>
<script type="text/babel" src="glow_conpoint.ts"></script>
<script type="text/babel" src="glow_draw.ts"></script>
<script type="text/babel" src="glow_line.ts"></script>
<script type="text/babel" src="glow_node.ts"></script>
<script type="text/babel" src="glow_nodeclass.ts"></script>
......
......@@ -108,7 +108,7 @@ class Appl {
let arrTmp = ["pwrb", "pwrs", "nmps", "profibus", "otherio", "opc",
"basecomponent", "abb", "siemens", "ssabox"];
if (arrTmp.some(e => urlValue.startsWith(e + "_"))) { // Object reference manual
urlValue = "$pwr_doc/" + getLang() + "/orm/" + urlValue;
urlValue = "$pwr_doc/en_us/orm/" + urlValue;
}
console.log("open url " + urlValue);
......@@ -160,15 +160,15 @@ class Appl {
}
}
} else if (command === ("HELP")) {
let fileName = "xtt_help_";
let fileName = "/pwrp_web/xtt_help_";
let bookmarkValue = null;
if (cli.qualifierFound("/VERSION")) {
fileName = this.pwrHost + "xtt_version_help_version.html";
fileName = window.location.hostname + "/pwr_doc/xtt_version_help_version.html";
this.openURL(fileName, null);
} else {
if (cli.qualifierFound("/BASE")) { // Not language dependent !! TODO
fileName = this.pwrHost + "help/xtt_help_";
fileName = "/pwr_doc/help/xtt_help_";
}
for (let i = 0; i < 4; i++) {
......@@ -179,14 +179,14 @@ class Appl {
let arrTmp = ["pwrb", "pwrs", "nmps", "profibus", "otherio", "opc",
"basecomponent", "abb", "siemens", "ssabox"];
if (arrTmp.some(e => fileName.startsWith(e + "_"))) { // Object reference manual
fileName = "$pwr_doc/orm/" + fileName;
fileName = "/pwr_doc/orm/" + fileName;
}
bookmarkValue = getQualIfExists("/BOOKMARK");
fileName += ".html";
console.log("Loading helpfile \"" + fileName + "\"");
this.openURL(fileName, bookmarkValue);
this.openURL(window.location.hostname + fileName, bookmarkValue);
}
} else if (command === ("CHECK")) {
let cli_arg1 = getQualIfExists("cli_arg1");
......
......@@ -81,7 +81,7 @@ class GlowArc {
idx = Math.max(0, idx);
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
this.ctx.gdraw.arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, this.angle1,
this.angle2, this.draw_type, idx, highlight);
this.angle2, this.draw_type, false, idx, highlight);
}
draw_shadow(border, shadow, highlight, hot) {
......@@ -110,78 +110,78 @@ class GlowArc {
this.ctx.gdraw.arc(ll_x + idx / 2 - idx + offs, ll_y + idx / 2 - idx +
offs, ur_x - ll_x + idx - offs * 2, ur_y - ll_y + idx - offs *
2, this.angle1 + 45, this.angle2 - 45,
GlowColor.shift_drawtype(this.draw_type, -2, null), ish - 1,
GlowColor.shift_drawtype(this.draw_type, -2, null), false, ish - 1,
highlight);
this.ctx.gdraw.arc(ll_x + idx / 2 - idx + offs, ll_y + idx / 2 - idx +
offs, ur_x - ll_x + idx - offs * 2, ur_y - ll_y + idx - offs * 2,
this.angle1, this.angle2 - 45,
GlowColor.shift_drawtype(this.draw_type, 2, null), ish - 1,
GlowColor.shift_drawtype(this.draw_type, 2, null), false, ish - 1,
highlight);
this.ctx.gdraw.arc(ll_x + idx / 2 - offs, ll_y + idx / 2 - offs,
Math.max(0, ur_x - ll_x - idx + offs * 2),
Math.max(0, ur_y - ll_y - idx + offs * 2), this.angle1 +
45, this.angle2 - 45,
GlowColor.shift_drawtype(this.draw_type, 2, null), ish - 1,
GlowColor.shift_drawtype(this.draw_type, 2, null), false, ish - 1,
highlight);
this.ctx.gdraw.arc(ll_x + idx / 2 - offs, ll_y + idx / 2 - offs,
Math.max(0, ur_x - ll_x - idx + offs * 2),
Math.max(0, ur_y - ll_y - idx + offs * 2), this.angle1, this.angle2 -
45, GlowColor.shift_drawtype(this.draw_type, -2, null), ish - 1,
45, GlowColor.shift_drawtype(this.draw_type, -2, null), false, ish - 1,
highlight);
} else if (this.angle1 === 90) {
this.ctx.gdraw.arc(ll_x + idx / 2 - idx + offs, ll_y + idx / 2 - idx +
offs, ur_x - ll_x + idx - offs * 2, ur_y - ll_y + idx - offs * 2,
this.angle1, this.angle2,
GlowColor.shift_drawtype(this.draw_type, -2, null), ish - 1,
GlowColor.shift_drawtype(this.draw_type, -2, null), false, ish - 1,
highlight);
this.ctx.gdraw.arc(ll_x + idx / 2 - offs, ll_y + idx / 2 - offs,
Math.max(0, ur_x - ll_x - idx + offs * 2),
Math.max(0, ur_y - ll_y - idx + offs * 2), this.angle1, this.angle2,
GlowColor.shift_drawtype(this.draw_type, 2, null), ish - 1,
GlowColor.shift_drawtype(this.draw_type, 2, null), false, ish - 1,
highlight);
} else if (this.angle1 === 180) {
this.ctx.gdraw.arc(ll_x + idx / 2 - idx + offs, ll_y + idx / 2 - idx +
offs, ur_x - ll_x + idx - offs * 2, ur_y - ll_y + idx - offs *
2, this.angle1 + 45, this.angle2 - 45,
GlowColor.shift_drawtype(this.draw_type, 2, null), ish - 1,
GlowColor.shift_drawtype(this.draw_type, 2, null), false, ish - 1,
highlight);
this.ctx.gdraw.arc(ll_x + idx / 2 - idx + offs, ll_y + idx / 2 - idx +
offs, ur_x - ll_x + idx - offs * 2, ur_y - ll_y + idx - offs * 2,
this.angle1, this.angle2 - 45,
GlowColor.shift_drawtype(this.draw_type, -2, null), ish - 1,
GlowColor.shift_drawtype(this.draw_type, -2, null), false, ish - 1,
highlight);
this.ctx.gdraw.arc(ll_x + idx / 2 - offs, ll_y + idx / 2 - offs,
Math.max(0, ur_x - ll_x - idx + offs * 2),
Math.max(0, ur_y - ll_y - idx + offs * 2), this.angle1 +
45, this.angle2 - 45,
GlowColor.shift_drawtype(this.draw_type, -2, null), ish - 1,
GlowColor.shift_drawtype(this.draw_type, -2, null), false, ish - 1,
highlight);
this.ctx.gdraw.arc(ll_x + idx / 2 - offs, ll_y + idx / 2 - offs,
Math.max(0, ur_x - ll_x - idx + offs * 2),
Math.max(0, ur_y - ll_y - idx + offs * 2), this.angle1, this.angle2 -
45, GlowColor.shift_drawtype(this.draw_type, 2, null), ish - 1,
45, GlowColor.shift_drawtype(this.draw_type, 2, null), false, ish - 1,
highlight);
} else if (this.angle1 === 270) {
this.ctx.gdraw.arc(ll_x + idx / 2 - idx + offs, ll_y + idx / 2 - idx +
offs, ur_x - ll_x + idx - offs * 2, ur_y - ll_y + idx - offs * 2,
this.angle1, this.angle2,
GlowColor.shift_drawtype(this.draw_type, 2, null), ish - 1,
GlowColor.shift_drawtype(this.draw_type, 2, null), false, ish - 1,
highlight);
this.ctx.gdraw.arc(ll_x + idx / 2 - offs, ll_y + idx / 2 - offs,
Math.max(0, ur_x - ll_x - idx + offs * 2),
Math.max(0, ur_y - ll_y - idx + offs * 2), this.angle1, this.angle2,
GlowColor.shift_drawtype(this.draw_type, -2, null), ish - 1,
GlowColor.shift_drawtype(this.draw_type, -2, null), false, ish - 1,
highlight);
}
}
if (border !== 0) {
this.ctx.gdraw.arc(ll_x + idx / 2 - idx, ll_y + idx / 2 - idx, ur_x -
ll_x + idx, ur_y - ll_y + idx, this.angle1, this.angle2,
DrawType.Line, 0, highlight);
DrawType.Line, false, 0, highlight);
if (idx > 0) {
this.ctx.gdraw.arc(ll_x + idx / 2, ll_y + idx / 2,
Math.max(0, ur_x - ll_x - idx), Math.max(0, ur_y - ll_y - idx),
this.angle1, this.angle2, DrawType.Line, 0, highlight);
this.angle1, this.angle2, DrawType.Line, false, 0, highlight);
}
}
}
......
......@@ -111,8 +111,8 @@ class GrowAnnot extends GlowAnnot {
if (rot < 45 || rot >= 315) {
if (node.annotv_inputmode[this.number] !== 0 &&
node.input_selected !== 0) {
this.ctx.gdraw.fill_rect(x1, y1 - height + descent, width, height,
DrawType.MediumGray);
this.ctx.gdraw.rect(x1, y1 - height + descent, width, height,
DrawType.MediumGray, true, 0);
}
} else {
// Text is rotated, adjust the coordinates
......@@ -143,7 +143,7 @@ class GrowAnnot extends GlowAnnot {
}
this.ctx.gdraw.text(x1, y1, node.annotv[this.number], ldraw_type, color,
idx, highlight, 0, lfont, tsize, rot);
idx, highlight, lfont, tsize, rot);
break;
case AnnotType.MultiLine:
break;
......@@ -167,8 +167,8 @@ class GrowAnnot extends GlowAnnot {
}
idx = Math.min(idx, DRAW_TYPE_SIZE - 1);
return this.ctx.gdraw.getTextExtent(node.annotv[this.number], idx,
this.font, this.draw_type);
return this.ctx.gdraw.getTextExtent(node.annotv[this.number], this.draw_type, idx,
this.font);
}
event_handler(event, fx, fy) {
......
......@@ -230,8 +230,8 @@ class GrowArc extends GlowArc {
if (!display_shadow || this.shadow_width === 0 || this.angle2 !== 360) {
if (grad === Gradient.No || fillcolor === DrawType.ColorRed) {
let drawtype = (chot === 0) ? fillcolor : GlowColor.shift_drawtype(fillcolor, chot, null);
this.ctx.gdraw.fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y -
ll_y, this.angle1 - rot, this.angle2, drawtype);
this.ctx.gdraw.arc(ll_x, ll_y, ur_x - ll_x, ur_y -
ll_y, this.angle1 - rot, this.angle2, drawtype, true, 0);
} else {
let fa1, fa2;
if (this.gradient_contrast >= 0) {
......@@ -265,15 +265,15 @@ class GrowArc extends GlowArc {
let drawtype = GlowColor.shift_drawtype(fillcolor, -drawtype_incr + chot,
colornode);
this.ctx.gdraw.fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, 35, 140,
drawtype);
this.ctx.gdraw.arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, 35, 140,
drawtype, true, 0);
// Draw dark shadow
drawtype = GlowColor.shift_drawtype(fillcolor, drawtype_incr + chot,
colornode);
this.ctx.gdraw.fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, 215,
140, drawtype);
this.ctx.gdraw.arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, 215,
140, drawtype, true, 0);
// Draw medium shadow and body
if (chot === 0) {
......@@ -282,14 +282,14 @@ class GrowArc extends GlowArc {
drawtype = GlowColor.shift_drawtype(fillcolor, chot, null);
}
this.ctx.gdraw.fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, -5, 40,
drawtype);
this.ctx.gdraw.fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, 175, 40,
drawtype);
this.ctx.gdraw.arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, -5, 40,
drawtype, true, 0);
this.ctx.gdraw.arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, 175, 40,
drawtype, true, 0);
this.ctx.gdraw.fill_arc(ll_x + ish, ll_y + ish, ur_x - ll_x - 2 *
this.ctx.gdraw.arc(ll_x + ish, ll_y + ish, ur_x - ll_x - 2 *
ish, ur_y - ll_y - 2 * ish, this.angle1 - rot, this.angle2,
drawtype);
drawtype, true, 0);
} else {
// Draw shadow
let fb1 = GlowColor.shift_drawtype(fillcolor, -drawtype_incr + chot,
......@@ -328,7 +328,7 @@ class GrowArc extends GlowArc {
GlowColor.get_drawtype(this.draw_type, DrawType.LineHighlight,
highlight, colornode, 0, 0);
this.ctx.gdraw.arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, this.angle1 -
rot, this.angle2, drawtype, idx);
rot, this.angle2, drawtype, false, idx);
}
}
......
......@@ -232,8 +232,8 @@ class GrowAxis extends GrowRect {
if (i % this.valuequotient === 0) {
let text = this.format_text(this.format, this.max_value - i *
this.increment);
let p = this.ctx.gdraw.getTextExtent(text, Math.max(0, text_idx),
Font.Helvetica, this.text_drawtype);
let p = this.ctx.gdraw.getTextExtent(text, this.text_drawtype, Math.max(0, text_idx),
Font.Helvetica);
z_width = p.x;
z_height = p.y;
z_descent = z_height / 4;
......@@ -275,8 +275,7 @@ class GrowAxis extends GrowRect {
y_text = y + (z_height - z_descent) / 2;
}
this.ctx.gdraw.text(ll_x, y_text, text, this.text_drawtype,
this.text_color_drawtype, text_idx, highlight, 0,
Font.Helvetica, tsize, 0);
this.text_color_drawtype, text_idx, highlight, Font.Helvetica, tsize, 0);
}
}
}
......@@ -287,8 +286,8 @@ class GrowAxis extends GrowRect {
// Calculate max value text height
if (draw_text) {
let p2 = this.ctx.gdraw.getTextExtent("0", Math.max(0, text_idx),
Font.Helvetica, this.text_drawtype);
let p2 = this.ctx.gdraw.getTextExtent("0", this.text_drawtype, Math.max(0, text_idx),
Font.Helvetica);
z_width = p2.x;
z_height = p2.y;
......@@ -314,8 +313,8 @@ class GrowAxis extends GrowRect {
if (draw_text && i % this.valuequotient === 0) {
let text =
this.format_text(this.format, this.max_value - i * this.increment);
let p3 = this.ctx.gdraw.getTextExtent(text, Math.max(0, text_idx),
Font.Helvetica, this.text_drawtype);
let p3 = this.ctx.gdraw.getTextExtent(text, this.text_drawtype, Math.max(0, text_idx),
Font.Helvetica);
z_width = p3.x;
z_height = p3.y;
z_descent = z_height / 4;
......@@ -330,7 +329,7 @@ class GrowAxis extends GrowRect {
}
this.ctx.gdraw.text(x_text, ll_y + z_height - z_descent, text,
this.text_drawtype, this.text_color_drawtype, text_idx, highlight,
0, Font.Helvetica, tsize, 0);
Font.Helvetica, tsize, 0);
}
}
}
......@@ -345,8 +344,8 @@ class GrowAxis extends GrowRect {
if (i % this.valuequotient === 0) {
let text = this.format_text(this.format, this.max_value - i *
this.increment);
let p4 = this.ctx.gdraw.getTextExtent(text, Math.max(0, text_idx),
Font.Helvetica, this.text_drawtype);
let p4 = this.ctx.gdraw.getTextExtent(text, this.text_drawtype, Math.max(0, text_idx),
Font.Helvetica);
z_width = p4.x;
z_height = p4.y;
z_descent = z_height / 4;
......@@ -388,8 +387,7 @@ class GrowAxis extends GrowRect {
y_text = y + (z_height - z_descent) / 2;
}
this.ctx.gdraw.text(x_text, y_text, text, this.text_drawtype,
this.text_color_drawtype, text_idx, highlight, 0,
Font.Helvetica, tsize, 0);
this.text_color_drawtype, text_idx, highlight, Font.Helvetica, tsize, 0);
}
}
} else { // if ( 225 < rotation && rotation <= 315)
......@@ -399,8 +397,8 @@ class GrowAxis extends GrowRect {
// Calculate max value text height
if (draw_text) {
let p5 = this.ctx.gdraw.getTextExtent("0", Math.max(0, text_idx),
Font.Helvetica, this.text_drawtype);
let p5 = this.ctx.gdraw.getTextExtent("0", this.text_drawtype, Math.max(0, text_idx),
Font.Helvetica);
z_width = p5.x;
z_height = p5.y;
......@@ -424,8 +422,8 @@ class GrowAxis extends GrowRect {
if (draw_text && i % this.valuequotient === 0) {
let text =
this.format_text(this.format, this.max_value - i * this.increment);
let p6 = this.ctx.gdraw.getTextExtent(text, Math.max(0, text_idx),
Font.Helvetica, this.text_drawtype);
let p6 = this.ctx.gdraw.getTextExtent(text, this.text_drawtype, Math.max(0, text_idx),
Font.Helvetica);
z_width = p6.x;
z_height = p6.y;
z_descent = z_height / 4;
......@@ -439,8 +437,7 @@ class GrowAxis extends GrowRect {
x_text = x - (z_width) / 2;
}
this.ctx.gdraw.text(x_text, ur_y, text, this.text_drawtype,
this.text_color_drawtype, text_idx, highlight, 0,
Font.Helvetica, tsize, 0);
this.text_color_drawtype, text_idx, highlight, Font.Helvetica, tsize, 0);
}
}
}
......
......@@ -168,8 +168,8 @@ class GrowAxisArc extends GrowArc {
} else {
text = this.format_text(this.format, this.min_value + this.increment);
}
let p = this.ctx.gdraw.getTextExtent(text, Math.max(0, text_idx),
Font.Helvetica, this.text_drawtype);
let p = this.ctx.gdraw.getTextExtent(text, this.text_drawtype, Math.max(0, text_idx),
Font.Helvetica);
z_width = p.x;
z_height = p.y;
z_descent = z_height / 4;
......@@ -209,8 +209,8 @@ class GrowAxisArc extends GrowArc {
(this.increment < 0 && i === 0)))) {
text = this.format_text(this.format, this.min_value + i *
this.increment);
p = this.ctx.gdraw.getTextExtent(text, Math.max(0, text_idx),
Font.Helvetica, this.text_drawtype);
p = this.ctx.gdraw.getTextExtent(text, this.text_drawtype, Math.max(0, text_idx),
Font.Helvetica);
z_width = p.x;
z_height = p.y;
z_descent = z_height / 4;
......@@ -228,8 +228,7 @@ class GrowAxisArc extends GrowArc {
xt -= z_width / 2;
}
this.ctx.gdraw.text(xt, yt, text, this.text_drawtype,
this.text_color_drawtype, text_idx, highlight, 0,
Font.Helvetica, tsize, 0);
this.text_color_drawtype, text_idx, highlight, Font.Helvetica, tsize, 0);
}
}
}
......
......@@ -127,8 +127,8 @@ class GrowBar extends GrowRect {
highlight, colornode, 1, 0);
if (grad === Gradient.No) {
this.ctx.gdraw.fill_rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
drawtype);
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();
......@@ -199,7 +199,7 @@ class GrowBar extends GrowRect {
}
if (grad === Gradient.No) {
this.ctx.gdraw.fill_rect(x0, y0, width, height, dt);
this.ctx.gdraw.rect(x0, y0, width, height, dt, true, 0);
} else {
rotation = (t) ? this.trf.rot(t) : this.trf.rot();
......@@ -225,8 +225,7 @@ class GrowBar extends GrowRect {
}
if (this.border !== 0) {
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, idx,
0);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, false, idx);
}
}
......
......@@ -118,12 +118,12 @@ class GrowBarArc extends GrowArc {
let bg_drawtype = (this.background_drawtype === DrawType.No) ? this.ctx.background_color : this.background_drawtype;
// Draw circle background
this.ctx.gdraw.fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, 0, 360,
bg_drawtype);
this.ctx.gdraw.arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, 0, 360,
bg_drawtype, true, 0);
// Draw bar background
this.ctx.gdraw.fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, this.angle1 -
Math.floor(rotation), this.angle2, drawtype);
this.ctx.gdraw.arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, this.angle1 -
Math.floor(rotation), this.angle2, drawtype, true, 0);
// Draw bar
let ang = this.angle1 - rotation;
......@@ -132,9 +132,8 @@ class GrowBarArc extends GrowArc {
}
if (this.gradient === Gradient.No) {
this.ctx.gdraw.fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
ang, this.angle2 * (value - this.min_value) /
(this.max_value - this.min_value), this.bar_drawtype);
this.ctx.gdraw.arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, ang,
this.angle2 * (value - this.min_value) / (this.max_value - this.min_value), this.bar_drawtype, true, 0);
} else {
let f1, f2;
if (this.gradient_contrast >= 0) {
......@@ -157,8 +156,8 @@ class GrowBarArc extends GrowArc {
}
// Draw inner circle background
this.ctx.gdraw.fill_arc(ll_x + width, ll_y + yscale * width, ur_x - ll_x -
2 * width, ur_y - ll_y - yscale * 2 * width, 0, 360, bg_drawtype);
this.ctx.gdraw.arc(ll_x + width, ll_y + yscale * width, ur_x - ll_x -
2 * width, ur_y - ll_y - yscale * 2 * width, 0, 360, bg_drawtype, true, 0);
if (this.bar_direction === 0) {
ang = Math.PI *
......@@ -181,11 +180,11 @@ class GrowBarArc extends GrowArc {
DrawType.LineHighlight, highlight, colornode, 0, 0);
this.ctx.gdraw.arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, this.angle1 -
Math.floor(rotation), this.angle2, bordercolor, idx);
Math.floor(rotation), this.angle2, bordercolor, false, idx);
this.ctx.gdraw.arc(ll_x + width, ll_y + yscale * width, ur_x - ll_x - 2 *
width, ur_y - ll_y - yscale * 2 * width, this.angle1 -
Math.floor(rotation), this.angle2, bordercolor, idx);
Math.floor(rotation), this.angle2, bordercolor, false, idx);
ang = Math.PI * (this.angle1 - rotation) / 180;
this.ctx.gdraw.line((ur_x + ll_x) / 2 + (ur_x - ll_x) / 2 *
......
......@@ -230,8 +230,8 @@ class GrowBarChart extends GrowRect {
} else {
drawtype = GlowColor.shift_drawtype(fillcolor, chot, null);
}
this.ctx.gdraw.fill_rect(bar_ll_x, bar_up_ll_y, bar_ur_x -
bar_ll_x, bar_up_ur_y - bar_up_ll_y, drawtype);
this.ctx.gdraw.rect(bar_ll_x, bar_up_ll_y, bar_ur_x -
bar_ll_x, bar_up_ur_y - bar_up_ll_y, drawtype, true, 0);
} else {
let f1, f2;
if (this.gradient_contrast >= 0) {
......@@ -291,8 +291,8 @@ class GrowBarChart extends GrowRect {
if (grad === Gradient.No ||
fillcolor === DrawType.ColorRed || i === this.barsegments) {
let drawtype = (chot === 0) ? fillcolor : GlowColor.shift_drawtype(fillcolor, chot, null);
this.ctx.gdraw.fill_rect(bar_ll_x, bar_down_ll_y, bar_ur_x -
bar_ll_x, bar_down_ur_y - bar_down_ll_y, drawtype);
this.ctx.gdraw.rect(bar_ll_x, bar_down_ll_y, bar_ur_x -
bar_ll_x, bar_down_ur_y - bar_down_ll_y, drawtype, true, 0);
} else {
let f1, f2;
if (this.gradient_contrast >= 0) {
......@@ -324,7 +324,7 @@ class GrowBarChart extends GrowRect {
DrawType.LineHighlight, highlight, colornode, 0, 0);
this.ctx.gdraw.rect(brect_ll_x, brect_ll_y, brect_width,
brect_height, drawtype, idx, 0);
brect_height, drawtype, false, idx);
}
if (this.min_value >= 0) {
brect_ll_x = bar_ll_x;
......@@ -344,7 +344,7 @@ class GrowBarChart extends GrowRect {
DrawType.LineHighlight, highlight, colornode, 0, 0);
this.ctx.gdraw.rect(brect_ll_x, brect_ll_y, brect_width,
brect_height, drawtype, idx, 0);
brect_height, drawtype, false, idx);
}
// Draw negative bar border
......@@ -354,7 +354,7 @@ class GrowBarChart extends GrowRect {
DrawType.LineHighlight, highlight, colornode, 0, 0);
this.ctx.gdraw.rect(brect_ll_x, brect_ll_y, brect_width,
brect_height, drawtype, idx, 0);
brect_height, drawtype, false, idx);
}
brect_ll_x = bar_ll_x;
brect_ll_y = ur_y + this.min_value * (ur_y - ll_y) /
......@@ -367,7 +367,7 @@ class GrowBarChart extends GrowRect {
DrawType.LineHighlight, highlight, colornode, 0, 0);
this.ctx.gdraw.rect(brect_ll_x, brect_ll_y, brect_width,
brect_height, drawtype, idx, 0);
brect_height, drawtype, false, idx);
}
}
}
......@@ -394,8 +394,7 @@ class GrowBarChart extends GrowRect {
drawtype =
GlowColor.get_drawtype(this.draw_type, DrawType.LineHighlight,
highlight, colornode, 0, 0);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, idx,
0);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, false, idx);
}
}
......
This diff is collapsed.
......@@ -77,7 +77,7 @@ class GrowCtx extends Rect {
a: GlowArray;
a_nc: GlowArray;
a_cc: GlowArray;
gdraw: GlowDraw;
gdraw: Draw;
constructor(ctx) {
super();
......@@ -90,7 +90,7 @@ class GrowCtx extends Rect {
if (ctx) {
this.gdraw = ctx.gdraw;
} else {
this.gdraw = new GlowDraw(this);
this.gdraw = new Draw(this);
}
}
......@@ -635,8 +635,8 @@ class GrowCtx extends Rect {
draw(t = null, highlight = 0, hot = 0, node = null, colornode = null) {
// Draw background color
this.gdraw.fill_rect(0, 0, this.gdraw.canvas.width,
this.gdraw.canvas.height, this.background_color);
this.gdraw.rect(0, 0, this.gdraw.canvas.width,
this.gdraw.canvas.height, this.background_color, true, 0);
// Draw connections
this.a.forEach(function (e) {
......
......@@ -443,9 +443,9 @@ class GrowFolder extends GrowWindow {
p[3].y = ll_y + h;
if (i === this.current_folder) {
this.ctx.gdraw.fill_polyline(p, 4, this.color_selected, 0);
this.ctx.gdraw.polyline(p, 4, this.color_selected, true, 0);
} else {
this.ctx.gdraw.fill_polyline(p, 4, this.color_unselected, 0);
this.ctx.gdraw.polyline(p, 4, this.color_unselected, true, 0);
if (this.shadow !== 0) {
this.ctx.gdraw.line(p[0].x + 1, p[0].y, p[1].x + 1, p[1].y,
drawtype_light, 0, 0);
......@@ -456,7 +456,7 @@ class GrowFolder extends GrowWindow {
new Point(x + h / 8, ll_y + h / 4),
new Point(x + h / 2, ll_y + h)];
this.ctx.gdraw.fill_polyline(ps, 4, drawtype_dark, 0);
this.ctx.gdraw.polyline(ps, 4, drawtype_dark, true, 0);
}
}
}
......@@ -471,12 +471,11 @@ class GrowFolder extends GrowWindow {
this.ctx.gdraw.line(p[1].x, p[1].y + 1, p[2].x, p[2].y + 1,
drawtype_light, 0, 0);
}
this.ctx.gdraw.polyline(p, 4, drawtype, idx, 0);
this.ctx.gdraw.polyline(p, 4, drawtype, false, idx);
if (text_idx >= 0 && this.folder_text[i] !== null) {
this.ctx.gdraw.text(x + h / 2, ll_y + h - 2, this.folder_text[i],
this.text_drawtype, this.text_color_drawtype, text_idx, highlight, 0,
Font.Helvetica, tsize, 0);
this.text_drawtype, this.text_color_drawtype, text_idx, highlight, Font.Helvetica, tsize, 0);
}
if (i === this.current_folder) {
break;
......
......@@ -151,7 +151,6 @@ class GrowImage extends Rect {
let ll_y = Math.min(y1, y2);
let ur_y = Math.max(y1, y2);
// this.ctx.gdraw.rect( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, DrawType.Line, idx, 0);
this.ctx.gdraw.image(this.image, ll_x, ll_y, ur_x - ll_x, ur_y - ll_y);
}
......
......@@ -113,12 +113,7 @@ class GrowLine extends GlowLine {
GlowColor.get_drawtype(this.draw_type, DrawType.LineHighlight,
highlight, colornode, 0, 0);
if (this.line_type === LineType.Solid) {
this.ctx.gdraw.line(x1, y1, x2, y2, drawtype, idx, 0);
} else {
this.ctx.gdraw.line_dashed(x1, y1, x2, y2, drawtype, idx, 0,
this.line_type);
}
this.ctx.gdraw.line(x1, y1, x2, y2, drawtype, idx, 0, this.line_type);
}
get_borders(t, g) {
......
......@@ -67,8 +67,8 @@ class GrowMenu extends GrowRect {
this.item_cnt = 0;
this.info.item.forEach(function (e) {
if (e.occupied) {
let p = this.ctx.gdraw.getTextExtent(e.text,
Math.max(0, text_idx), this.font, this.text_drawtype);
let p = this.ctx.gdraw.getTextExtent(e.text, this.text_drawtype,
Math.max(0, text_idx), this.font);
z_width = p.x;
z_height = p.y;
z_descent = z_height / 4;
......@@ -119,8 +119,8 @@ class GrowMenu extends GrowRect {
this.get_node_borders();
if (this.fill !== 0) {
this.ctx.gdraw.fill_rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
this.fill_drawtype);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
this.fill_drawtype, true, 0);
}
this.item_height = tot_z_height / this.item_cnt;
......@@ -135,17 +135,16 @@ class GrowMenu extends GrowRect {
} else {
drawtype = GlowColor.shift_drawtype(this.fill_drawtype, -2, null);
}
this.ctx.gdraw.fill_rect(ll_x,
Math.floor(ll_y + item_idx * this.item_height), ur_x - ll_x,
Math.floor(this.item_height), drawtype);
this.ctx.gdraw.rect(ll_x, Math.floor(ll_y + item_idx * this.item_height), ur_x - ll_x,
Math.floor(this.item_height), drawtype, true, 0);
}
let x_text = ll_x + 3;
if (e.type === MenuItem.ButtonDisabled) {
this.ctx.gdraw.text(x_text, y_text, e.text, this.text_drawtype,
this.text_color_disabled, text_idx, highlight, 0, this.font, tsize, 0);
this.text_color_disabled, text_idx, highlight, this.font, tsize, 0);
} else {
this.ctx.gdraw.text(x_text, y_text, e.text, this.text_drawtype,
this.text_color, text_idx, highlight, 0, this.font, tsize, 0);
this.text_color, text_idx, highlight, this.font, tsize, 0);
}
if (e.type === MenuItem.PulldownMenu) {
// Draw arrow
......@@ -159,14 +158,14 @@ class GrowMenu extends GrowRect {
new Point(ur_x - arrow_size - 2, Math.floor(ll_y + item_idx *
this.item_height + this.item_height / 2 - arrow_size / 2)),
];
this.ctx.gdraw.fill_polyline(p, 4, DrawType.MediumGray, 0);
this.ctx.gdraw.polyline(p, 4, DrawType.MediumGray, true, 0);
}
item_idx++;
}
});
if (this.border !== 0) {
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, this.draw_type,
idx, 0);
false, idx);
}
}
......
......@@ -216,8 +216,8 @@ class GrowPie extends GrowArc {
if (grad === Gradient.No || fillcolor === DrawType.ColorRed) {
let drawtype = (chot === 0) ? fillcolor : GlowColor.shift_drawtype(fillcolor, chot, null);
this.ctx.gdraw.fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, ia1 - rot,
ia2, drawtype);
this.ctx.gdraw.arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, ia1 - rot,
ia2, drawtype, true, 0);
} else if (!display_shadow || this.shadow_width === 0) {
let f1, f2;
if (this.gradient_contrast >= 0) {
......
......@@ -287,8 +287,8 @@ class GrowPolyline extends GlowPolyline {
}
if (grad === Gradient.No || drawtype === DrawType.ColorRed) {
this.ctx.gdraw.fill_polyline(this.points, this.a_points.size(),
drawtype, 0);
this.ctx.gdraw.polyline(this.points, this.a_points.size(),
drawtype, true, 0);
} else {
let rotation = t ? this.trf.rot(t) : this.trf.rot();
......@@ -328,7 +328,7 @@ class GrowPolyline extends GlowPolyline {
sp[i + 1],
this.points[i + 1]
];
this.ctx.gdraw.fill_polyline(p, 4, sp[i].drawtype, 0);
this.ctx.gdraw.polyline(p, 4, sp[i].drawtype, true, 0);
}
}
}
......
......@@ -222,7 +222,7 @@ class GrowRect extends GlowRect {
new Point(ll_x, ur_y),
new Point(ll_x, ll_y)
];
this.ctx.gdraw.fill_polyline(points, 7, drawtype, 0);
this.ctx.gdraw.polyline(points, 7, drawtype, true, 0);
// Draw dark shadow
drawtype =
......@@ -237,14 +237,14 @@ class GrowRect extends GlowRect {
new Point(ur_x, ll_y),
new Point(ur_x, ur_y)
];
this.ctx.gdraw.fill_polyline(points, 7, drawtype, 0);
this.ctx.gdraw.polyline(points, 7, drawtype, true, 0);
}
if (this.fill !== 0) {
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.fill_rect(ll_x + ish, ll_y + ish, ur_x - ll_x - 2 *
ish, ur_y - ll_y - 2 * ish, drawtype);
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();
......@@ -273,14 +273,13 @@ class GrowRect extends GlowRect {
fa0 = fillcolor;
}
this.ctx.gdraw.gradient_fill_rect(ll_x + ish, ll_y + ish, ur_x -
ll_x - 2 * ish, ur_y - ll_y - 2 * ish, fa0, fa1, fa2,
this.ctx.gdraw.gradient_rotate(rotationa, grad));
ll_x - 2 * ish, ur_y - ll_y - 2 * ish, fa0, fa1, fa2, this.ctx.gdraw.gradient_rotate(rotationa, grad));
}
} else {
if (grad === Gradient.No || fillcolor === DrawType.ColorRed) {
let drawtype = (chot === 0) ? fillcolor : GlowColor.shift_drawtype(fillcolor, chot, null);
this.ctx.gdraw.fill_rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
drawtype);
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();
......@@ -309,8 +308,7 @@ class GrowRect extends GlowRect {
fb0 = fillcolor;
}
this.ctx.gdraw.gradient_fill_rect(ll_x, ll_y, ur_x - ll_x, ur_y -
ll_y, fb0, fb1, fb2,
this.ctx.gdraw.gradient_rotate(rotationb, grad));
ll_y, fb0, fb1, fb2, this.ctx.gdraw.gradient_rotate(rotationb, grad));
}
}
}
......@@ -319,8 +317,7 @@ class GrowRect extends GlowRect {
let drawtype =
GlowColor.get_drawtype(this.draw_type, DrawType.LineHighlight,
highlight, colornode, 0, 0);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, idx,
0);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, false, idx);
}
}
......
......@@ -154,20 +154,20 @@ class GrowRectRounded extends GrowRect {
if (grad === Gradient.No) {
let drawtype = (chot === 0) ? fillcolor : GlowColor.shift_drawtype(fillcolor, chot, null);
this.ctx.gdraw.fill_rect(ll_x, ll_y + amount, ur_x - ll_x, ur_y -
ll_y - 2 * amount, drawtype);
this.ctx.gdraw.fill_rect(ll_x + amount, ll_y, ur_x - ll_x - 2 *
amount, amount, drawtype);
this.ctx.gdraw.fill_rect(ll_x + amount, ur_y - amount, ur_x - ll_x -
2 * amount, amount, drawtype);
this.ctx.gdraw.fill_arc(ll_x, ll_y, 2 * amount, 2 * amount, 90, 90,
drawtype);
this.ctx.gdraw.fill_arc(ll_x, ur_y - 2 * amount, 2 * amount, 2 *
amount, 180, 90, drawtype);
this.ctx.gdraw.fill_arc(ur_x - 2 * amount, ur_y - 2 * amount, 2 *
amount, 2 * amount, 270, 90, drawtype);
this.ctx.gdraw.fill_arc(ur_x - 2 * amount, ll_y, 2 * amount, 2 *
amount, 0, 90, drawtype);
this.ctx.gdraw.rect(ll_x, ll_y + amount, ur_x - ll_x, ur_y -
ll_y - 2 * amount, drawtype, true, 0);
this.ctx.gdraw.rect(ll_x + amount, ll_y, ur_x - ll_x - 2 *
amount, amount, drawtype, true, 0);
this.ctx.gdraw.rect(ll_x + amount, ur_y - amount, ur_x - ll_x -
2 * amount, amount, drawtype, true, 0);
this.ctx.gdraw.arc(ll_x, ll_y, 2 * amount, 2 * amount, 90, 90,
drawtype, true, 0);
this.ctx.gdraw.arc(ll_x, ur_y - 2 * amount, 2 * amount, 2 *
amount, 180, 90, drawtype, true, 0);
this.ctx.gdraw.arc(ur_x - 2 * amount, ur_y - 2 * amount, 2 *
amount, 2 * amount, 270, 90, drawtype, true, 0);
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();
......@@ -188,8 +188,7 @@ class GrowRectRounded extends GrowRect {
chot, null);
}
this.ctx.gdraw.gradient_fill_rectrounded(ll_x, ll_y, ur_x -
ll_x, ur_y - ll_y, amount, fillcolor, fa1, fa2,
this.ctx.gdraw.gradient_rotate(rotationa, grad));
ll_x, ur_y - ll_y, amount, fillcolor, fa1, fa2, this.ctx.gdraw.gradient_rotate(rotationa, grad));
}
} else {
let drawtype_incr = (this.relief === Relief.Down) ? -this.shadow_contrast : this.shadow_contrast;
......@@ -197,52 +196,52 @@ class GrowRectRounded extends GrowRect {
// Draw light shadow
let drawtype =
GlowColor.shift_drawtype(fillcolor, -drawtype_incr + chot, colornode);
this.ctx.gdraw.fill_rect(ll_x + amount, ll_y, ur_x - ll_x - 2 * amount,
ish, drawtype);
this.ctx.gdraw.fill_rect(ll_x, ll_y + amount, ish, ur_y - ll_y - 2 *
amount, drawtype);
this.ctx.gdraw.fill_arc(ll_x, ll_y, 2 * amount, 2 * amount, 90, 90,
drawtype);
this.ctx.gdraw.fill_arc(ll_x, ur_y - 2 * amount, 2 * amount, 2 * amount,
180, 45, drawtype);
this.ctx.gdraw.fill_arc(ur_x - 2 * amount, ll_y, 2 * amount, 2 * amount,
45, 45, drawtype);
this.ctx.gdraw.rect(ll_x + amount, ll_y, ur_x - ll_x - 2 * amount,
ish, drawtype, true, 0);
this.ctx.gdraw.rect(ll_x, ll_y + amount, ish, ur_y - ll_y - 2 *
amount, drawtype, true, 0);
this.ctx.gdraw.arc(ll_x, ll_y, 2 * amount, 2 * amount, 90, 90,
drawtype, true, 0);
this.ctx.gdraw.arc(ll_x, ur_y - 2 * amount, 2 * amount, 2 * amount,
180, 45, drawtype, true, 0);
this.ctx.gdraw.arc(ur_x - 2 * amount, ll_y, 2 * amount, 2 * amount,
45, 45, drawtype, true, 0);
// Draw dark shadow
drawtype =
GlowColor.shift_drawtype(fillcolor, drawtype_incr + chot, colornode);
this.ctx.gdraw.fill_rect(ll_x + amount, ur_y - ish, ur_x - ll_x - 2 *
amount, ish, drawtype);
this.ctx.gdraw.fill_rect(ur_x - ish, ll_y + amount, ish, ur_y - ll_y -
2 * amount, drawtype);
this.ctx.gdraw.fill_arc(ll_x, ur_y - 2 * amount, 2 * amount, 2 * amount,
225, 45, drawtype);
this.ctx.gdraw.fill_arc(ur_x - 2 * amount, ll_y, 2 * amount, 2 * amount,
0, 45, drawtype);
this.ctx.gdraw.fill_arc(ur_x - 2 * amount, ur_y - 2 * amount, 2 *
amount, 2 * amount, 270, 90, drawtype);
this.ctx.gdraw.rect(ll_x + amount, ur_y - ish, ur_x - ll_x - 2 *
amount, ish, drawtype, true, 0);
this.ctx.gdraw.rect(ur_x - ish, ll_y + amount, ish, ur_y - ll_y -
2 * amount, drawtype, true, 0);
this.ctx.gdraw.arc(ll_x, ur_y - 2 * amount, 2 * amount, 2 * amount,
225, 45, drawtype, true, 0);
this.ctx.gdraw.arc(ur_x - 2 * amount, ll_y, 2 * amount, 2 * amount,
0, 45, drawtype, true, 0);
this.ctx.gdraw.arc(ur_x - 2 * amount, ur_y - 2 * amount, 2 *
amount, 2 * amount, 270, 90, drawtype, true, 0);
if (grad === Gradient.No) {
let drawtype = (chot === 0) ? fillcolor : GlowColor.shift_drawtype(fillcolor, chot, null);
if (amount > ish) {
this.ctx.gdraw.fill_rect(ll_x + ish, ll_y + amount, ur_x - ll_x -
2 * ish, ur_y - ll_y - 2 * amount, drawtype);
this.ctx.gdraw.fill_rect(ll_x + amount, ll_y + ish, ur_x - ll_x -
2 * amount, amount - ish, drawtype);
this.ctx.gdraw.fill_rect(ll_x + amount, ur_y - amount, ur_x - ll_x -
2 * amount, amount - ish, drawtype);
this.ctx.gdraw.fill_arc(ll_x + ish, ll_y + ish, 2 * amount - 2 *
ish, 2 * amount - 2 * ish, 90, 90, drawtype);
this.ctx.gdraw.fill_arc(ll_x + ish, ur_y - 2 * amount + ish, 2 *
amount - 2 * ish, 2 * amount - 2 * ish, 180, 90, drawtype);
this.ctx.gdraw.fill_arc(ur_x - 2 * amount + ish, ur_y - 2 * amount +
this.ctx.gdraw.rect(ll_x + ish, ll_y + amount, ur_x - ll_x -
2 * ish, ur_y - ll_y - 2 * amount, drawtype, true, 0);
this.ctx.gdraw.rect(ll_x + amount, ll_y + ish, ur_x - ll_x -
2 * amount, amount - ish, drawtype, true, 0);
this.ctx.gdraw.rect(ll_x + amount, ur_y - amount, ur_x - ll_x -
2 * amount, amount - ish, drawtype, true, 0);
this.ctx.gdraw.arc(ll_x + ish, ll_y + ish, 2 * amount - 2 *
ish, 2 * amount - 2 * ish, 90, 90, drawtype, true, 0);
this.ctx.gdraw.arc(ll_x + ish, ur_y - 2 * amount + ish, 2 *
amount - 2 * ish, 2 * amount - 2 * ish, 180, 90, drawtype, true, 0);
this.ctx.gdraw.arc(ur_x - 2 * amount + ish, ur_y - 2 * amount +
ish, 2 * amount - 2 * ish, 2 * amount - 2 * ish, 270, 90,
drawtype);
this.ctx.gdraw.fill_arc(ur_x - 2 * amount + ish, ll_y + ish, 2 *
amount - 2 * ish, 2 * amount - 2 * ish, 0, 90, drawtype);
drawtype, true, 0);
this.ctx.gdraw.arc(ur_x - 2 * amount + ish, ll_y + ish, 2 *
amount - 2 * ish, 2 * amount - 2 * ish, 0, 90, drawtype, true, 0);
} else {
this.ctx.gdraw.fill_rect(ll_x + amount, ll_y + amount, ur_x - ll_x -
2 * amount, ur_y - ll_y - 2 * amount, drawtype);
this.ctx.gdraw.rect(ll_x + amount, ll_y + amount, ur_x - ll_x -
2 * amount, ur_y - ll_y - 2 * amount, drawtype, true, 0);
}
} else {
let rotationb = t ? this.trf.rot(t) : this.trf.rot();
......@@ -265,8 +264,7 @@ class GrowRectRounded extends GrowRect {
}
this.ctx.gdraw.gradient_fill_rectrounded(ll_x + ish, ll_y +
ish, ur_x - ll_x - 2 * ish, ur_y - ll_y - 2 * ish, amount - ish,
fillcolor, fb1, fb2,
this.ctx.gdraw.gradient_rotate(rotationb, grad));
fillcolor, fb1, fb2, this.ctx.gdraw.gradient_rotate(rotationb, grad));
}
}
}
......
......@@ -68,7 +68,7 @@ class GrowScrollBar extends GrowRect {
DrawType.LineHighlight, highlight, colornode, 0, 0);
let shift_drawtype;
this.ctx.gdraw.fill_rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, fdrawtype);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, fdrawtype, true, 0);
if (this.shadow !== 0) {
shift_drawtype = GlowColor.shift_drawtype(this.fill_drawtype, 2, null); // Dark
this.ctx.gdraw.line(ll_x + 1, ll_y + 1, ll_x + 1, ur_y - 1,
......@@ -106,7 +106,7 @@ class GrowScrollBar extends GrowRect {
y0 = ll_y;
break;
}
this.ctx.gdraw.fill_rect(x0, y0, width, height, this.bar_color);
this.ctx.gdraw.rect(x0, y0, width, height, this.bar_color, true, 0);
if (this.shadow !== 0) {
shift_drawtype = GlowColor.shift_drawtype(this.bar_color, -2, null); // Light
this.ctx.gdraw.line(x0 + 1, y0 + 1, x0 + 1, y0 + height - 1,
......@@ -119,11 +119,10 @@ class GrowScrollBar extends GrowRect {
this.ctx.gdraw.line(x0 + width - 1, y0 + 1, x0 + width - 1, y0 +
height - 1, shift_drawtype, 0, 0);
}
this.ctx.gdraw.rect(x0, y0, width, height, bdrawtype, idx, 0);
this.ctx.gdraw.rect(x0, y0, width, height, bdrawtype, false, idx);
}
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, bdrawtype, idx,
0);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, bdrawtype, false, idx);
}
set_value(value, length) {
......
......@@ -465,8 +465,8 @@ class GrowTable extends GrowRect {
if (this.header_row !== 0) {
if (this.fill !== 0) {
this.ctx.gdraw.fill_rect(ll_x, ll_y, ur_x - ll_x, header_h,
this.fill_drawtype);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, header_h,
this.fill_drawtype, true, 0);
}
this.ctx.gdraw.set_clip_rectangle(ll_x + header_w, ll_y, ur_x, ll_y +
......@@ -511,7 +511,7 @@ class GrowTable extends GrowRect {
this.ctx.gdraw.text(Math.floor(x + text_offs),
Math.floor(y + header_h - 4), this.header_text[i],
this.header_text_drawtype, this.header_text_color, header_text_idx,
highlight, 0, this.font, header_tsize, 0);
highlight, this.font, header_tsize, 0);
}
x += this.column_width[i] * this.ctx.mw.zoom_factor_x;
if (x > ur_x) {
......@@ -534,7 +534,7 @@ class GrowTable extends GrowRect {
this.ctx.gdraw.line(ll_x + header_w, ll_y, ll_x + header_w, ll_y +
header_h, drawtype, idx, 0);
}
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, header_h, drawtype, idx, 0);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, header_h, drawtype, false, idx);
if (this.header_column !== 0) {
// Draw header of header column header
......@@ -543,15 +543,15 @@ class GrowTable extends GrowRect {
this.ctx.gdraw.text(Math.floor(x + text_offs),
Math.floor(y + header_h - 4), this.header_text[0],
this.header_text_drawtype, this.header_text_color, header_text_idx,
highlight, 0, this.font, tsize, 0);
highlight, this.font, tsize, 0);
}
}
}
if (this.header_column !== 0) {
if (this.fill !== 0) {
this.ctx.gdraw.fill_rect(ll_x, ll_y + header_h, header_w, ur_y - ll_y -
header_h, this.fill_drawtype);
this.ctx.gdraw.rect(ll_x, ll_y + header_h, header_w, ur_y - ll_y -
header_h, this.fill_drawtype, true, 0);
}
this.ctx.gdraw.set_clip_rectangle(ll_x, ll_y + header_h, ll_x + header_w,
......@@ -562,9 +562,9 @@ class GrowTable extends GrowRect {
let x = ll_x;
let y = t_ll_y + this.row_height * this.ctx.mw.zoom_factor_y *
this.selected_cell_row;
this.ctx.gdraw.fill_rect(Math.floor(x), Math.floor(y), header_w,
this.ctx.gdraw.rect(Math.floor(x), Math.floor(y), header_w,
Math.floor(this.row_height * this.ctx.mw.zoom_factor_y),
sel_drawtype);
sel_drawtype, true, 0);
}
if (this.shadow !== 0) {
......@@ -610,8 +610,7 @@ class GrowTable extends GrowRect {
if (this.column_adjustment[0] === Adjustment.Right ||
this.column_adjustment[0] === Adjustment.Center) {
let width, height, descent;
let p = this.ctx.gdraw.getTextExtent(this.cell_value[offs],
text_idx, this.font, this.text_drawtype);
let p = this.ctx.gdraw.getTextExtent(this.cell_value[offs], this.text_drawtype, text_idx, this.font);
width = p.x;
height = p.y;
descent = height / 4;
......@@ -629,20 +628,20 @@ class GrowTable extends GrowRect {
}
this.ctx.gdraw.text(text_x, Math.floor(y - 5),
this.cell_value[offs], this.text_drawtype,
this.text_color_drawtype, text_idx, highlight, 0, this.font,
this.text_color_drawtype, text_idx, highlight, this.font,
tsize, 0);
}
}
}
this.ctx.gdraw.reset_clip_rectangle();
this.ctx.gdraw.rect(ll_x, ll_y + header_h - 1, header_w, ur_y - ll_y -
header_h + 1, drawtype, idx, 0);
header_h + 1, drawtype, false, idx);
}
// Draw table
if (this.fill !== 0) {
this.ctx.gdraw.fill_rect(o_ll_x, o_ll_y, o_ur_x - o_ll_x, o_ur_y - o_ll_y,
this.fill_drawtype);
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);
}
this.ctx.gdraw.set_clip_rectangle(o_ll_x, o_ll_y, o_ur_x, o_ur_y);
......@@ -656,11 +655,11 @@ class GrowTable extends GrowRect {
}
let y = t_ll_y + this.row_height * this.ctx.mw.zoom_factor_y *
this.selected_cell_row;
this.ctx.gdraw.fill_rect(Math.floor(x), Math.floor(y),
this.ctx.gdraw.rect(Math.floor(x), Math.floor(y),
Math.floor(this.column_width[this.selected_cell_column] *
this.ctx.mw.zoom_factor_x),
Math.floor(this.row_height * this.ctx.mw.zoom_factor_y),
sel_drawtype);
sel_drawtype, true, 0);
}
if (this.shadow !== 0) {
......@@ -768,8 +767,7 @@ class GrowTable extends GrowRect {
if (this.column_adjustment[i] === Adjustment.Right ||
this.column_adjustment[i] === Adjustment.Center) {
let width, height, descent;
let p = this.ctx.gdraw.getTextExtent(this.cell_value[offs],
text_idx, this.font, this.text_drawtype);
let p = this.ctx.gdraw.getTextExtent(this.cell_value[offs], this.text_drawtype, text_idx, this.font);
width = p.x;
height = p.y;
descent = height / 4;
......@@ -791,7 +789,7 @@ class GrowTable extends GrowRect {
this.ctx.gdraw.text(text_x, Math.floor(y - 5),
this.cell_value[offs], this.text_drawtype,
this.text_color_drawtype, text_idx, highlight, 0, this.font,
this.text_color_drawtype, text_idx, highlight, this.font,
tsize, 0);
}
}
......@@ -805,7 +803,7 @@ class GrowTable extends GrowRect {
// Draw frame
this.ctx.gdraw.rect(o_ll_x, o_ll_y, ur_x - o_ll_x, ur_y - o_ll_y, drawtype,
idx, 0);
false, idx);
if (this.input_focus !== 0) {
this.ctx.gdraw.line(ll_x - 2, ll_y - 2, ll_x - 2, ur_y + 2,
DrawType.DarkGray, 0, 0);
......
......@@ -122,8 +122,8 @@ class GrowText extends GlowText {
if (this.text !== "") {
if (highl !== 0 || (hot !== 0 && node === null) ||
this.adjustment !== Adjustment.Left) {
let p = this.ctx.gdraw.getTextExtent(this.text, Math.max(0, idx),
lfont, ldraw_type);
let p = this.ctx.gdraw.getTextExtent(this.text, ldraw_type, Math.max(0, idx),
lfont);
z_width = p.x;
z_height = p.y;
z_descent = z_height / 4;
......@@ -165,26 +165,25 @@ class GrowText extends GlowText {
}
if (highl !== 0) {
this.ctx.gdraw.rect(rx1, ry1, z_width, z_height,
DrawType.FillHighlight, Math.max(1, Math.min(idx + hot, 2)), 0);
this.ctx.gdraw.rect(rx1, ry1, z_width, z_height, DrawType.FillHighlight,
false, Math.max(1, Math.min(idx + hot, 2)));
} else if (hot !== 0 && node === null) {
this.ctx.gdraw.rect(rx1, ry1, z_width, z_height,
DrawType.LineGray, Math.max(Math.min(idx, 2), 1), 0);
this.ctx.gdraw.rect(rx1, ry1, z_width, z_height, DrawType.LineGray,
false, Math.max(Math.min(idx, 2), 1));
}
if (idx >= 0) {
let color = GlowColor.get_drawtype(this.color_drawtype,
DrawType.LineHighlight, highlight, colornode, 2, 0);
this.ctx.gdraw.text(x1, y1, this.text, ldraw_type, color, idx,
highlight, 0, lfont, tsize, rot);
highlight, lfont, tsize, rot);
}
} else if (idx >= 0) {
let p2 = this.ctx.gdraw.getTextExtent("A", Math.max(0, idx), lfont,
ldraw_type);
let p2 = this.ctx.gdraw.getTextExtent("A", ldraw_type, Math.max(0, idx), lfont);
z_width = p2.x;
z_height = p2.y;
z_descent = z_height / 4;
this.ctx.gdraw.rect(x1, y1 - (z_height - z_descent), z_width, z_height,
DrawType.LineGray, idx, 0);
DrawType.LineGray, false, idx);
}
}
......
......@@ -183,8 +183,8 @@ class GrowTrend extends GrowRect {
GlowColor.get_drawtype(this.fill_drawtype, DrawType.FillHighlight,
highlight, colornode, 1, 0);
if (grad === Gradient.No) {
this.ctx.gdraw.fill_rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
drawtype);
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();
......@@ -297,8 +297,7 @@ class GrowTrend extends GrowRect {
}
if (this.border !== 0) {
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, idx,
0);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, false, idx);
}
}
......
......@@ -180,8 +180,8 @@ class GrowWindow extends GrowRect {
// window_ctx->draw_buffer_only = ctx->draw_buffer_only;
if (this.fill !== 0) {
this.ctx.gdraw.fill_rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
this.fill_drawtype);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
this.fill_drawtype, true, 0);
}
this.ctx.gdraw.set_clip_rectangle(ll_x, ll_y, ur_x - 1, ur_y - 1);
......@@ -203,7 +203,7 @@ class GrowWindow extends GrowRect {
let drawtype =
GlowColor.get_drawtype(this.draw_type, DrawType.LineHighlight,
highlight, colornode, 0, 0);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, idx, 0);
this.ctx.gdraw.rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, false, idx);
}
new_ctx() {
......
......@@ -22,8 +22,8 @@
</div>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="crypt.ts"></script>
<script type="text/babel" src="pwr.js"></script>
<script type="text/babel" src="gdh.js"></script>
<script type="text/babel" src="pwr.ts"></script>
<script type="text/babel" src="gdh.ts"></script>
<script type="text/babel" src="opwind.ts"></script>
<hr>
<address><a href="mailto:claes@debian86.ssab.com"></a></address>
......
......@@ -34,10 +34,11 @@
</div>
<canvas id="flowcanvas" width="1200" height="800"></canvas>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="pwr.js"></script>
<script type="text/babel" src="cli.js"></script>
<script type="text/babel" src="gdh.js"></script>
<script type="text/babel" src="plow.js"></script>
<script type="text/babel" src="pwr.ts"></script>
<script type="text/babel" src="cli.ts"></script>
<script type="text/babel" src="gdh.ts"></script>
<script type="text/babel" src="draw.ts"></script>
<script type="text/babel" src="plow.ts"></script>
<script type="text/babel" src="xtt.ts"></script>
<hr>
<address><a href="mailto:claes@debian86.ssab.com"></a></address>
......
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