q5 4.7.2 → 4.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/q5.js +26 -24
package/package.json
CHANGED
package/q5.js
CHANGED
|
@@ -923,35 +923,37 @@ Q5.renderers.c2d.canvas = ($, q) => {
|
|
|
923
923
|
};
|
|
924
924
|
|
|
925
925
|
$.fill = function (c) {
|
|
926
|
-
$.
|
|
926
|
+
$.__doFill = $._fillSet = true;
|
|
927
927
|
if (Q5.Color) {
|
|
928
928
|
if (!c._isColor && (typeof c != 'string' || $._namedColors[c])) {
|
|
929
929
|
c = $.color(...arguments);
|
|
930
930
|
}
|
|
931
|
-
if (c.a <= 0) return ($.
|
|
931
|
+
if (c.a <= 0) return ($.__doFill = false);
|
|
932
932
|
}
|
|
933
933
|
$.ctx.fillStyle = $._fill = c.toString();
|
|
934
934
|
};
|
|
935
935
|
|
|
936
936
|
$.stroke = function (c) {
|
|
937
|
-
$.
|
|
937
|
+
$.__doStroke = $._strokeSet = true;
|
|
938
938
|
if (Q5.Color) {
|
|
939
939
|
if (!c._isColor && (typeof c != 'string' || $._namedColors[c])) {
|
|
940
940
|
c = $.color(...arguments);
|
|
941
941
|
}
|
|
942
|
-
if (c.a <= 0) return ($.
|
|
942
|
+
if (c.a <= 0) return ($.__doStroke = false);
|
|
943
943
|
}
|
|
944
944
|
$.ctx.strokeStyle = $._stroke = c.toString();
|
|
945
945
|
};
|
|
946
946
|
|
|
947
947
|
$.strokeWeight = (n) => {
|
|
948
|
-
if (!n) $.
|
|
949
|
-
else $.
|
|
948
|
+
if (!n) $.__doStroke = false;
|
|
949
|
+
else $.__doStroke = true;
|
|
950
950
|
$.ctx.lineWidth = $._strokeWeight = n || 0.0001;
|
|
951
951
|
};
|
|
952
952
|
|
|
953
|
-
$.noFill = () => ($.
|
|
954
|
-
$.noStroke = () => ($.
|
|
953
|
+
$.noFill = () => ($.__doFill = false);
|
|
954
|
+
$.noStroke = () => ($.__doStroke = false);
|
|
955
|
+
$._doFill = () => ($.__doFill = true);
|
|
956
|
+
$._doStroke = () => ($.__doStroke = true);
|
|
955
957
|
$.opacity = (a) => ($.ctx.globalAlpha = a);
|
|
956
958
|
|
|
957
959
|
$._doShadow = false;
|
|
@@ -1023,8 +1025,8 @@ Q5.renderers.c2d.canvas = ($, q) => {
|
|
|
1023
1025
|
'_fill',
|
|
1024
1026
|
'_stroke',
|
|
1025
1027
|
'_strokeWeight',
|
|
1026
|
-
'
|
|
1027
|
-
'
|
|
1028
|
+
'__doFill',
|
|
1029
|
+
'__doStroke',
|
|
1028
1030
|
'_fillSet',
|
|
1029
1031
|
'_strokeSet',
|
|
1030
1032
|
'_shadow',
|
|
@@ -1082,8 +1084,8 @@ Q5.renderers.c2d.canvas = ($, q) => {
|
|
|
1082
1084
|
};
|
|
1083
1085
|
};
|
|
1084
1086
|
Q5.renderers.c2d.shapes = ($) => {
|
|
1085
|
-
$.
|
|
1086
|
-
$.
|
|
1087
|
+
$.__doStroke = true;
|
|
1088
|
+
$.__doFill = true;
|
|
1087
1089
|
$._strokeSet = false;
|
|
1088
1090
|
$._fillSet = false;
|
|
1089
1091
|
$._ellipseMode = Q5.CENTER;
|
|
@@ -1093,8 +1095,8 @@ Q5.renderers.c2d.shapes = ($) => {
|
|
|
1093
1095
|
let curveBuff = [];
|
|
1094
1096
|
|
|
1095
1097
|
function ink() {
|
|
1096
|
-
if ($.
|
|
1097
|
-
if ($.
|
|
1098
|
+
if ($.__doFill) $.ctx.fill();
|
|
1099
|
+
if ($.__doStroke) $.ctx.stroke();
|
|
1098
1100
|
}
|
|
1099
1101
|
|
|
1100
1102
|
// DRAWING SETTINGS
|
|
@@ -1109,7 +1111,7 @@ Q5.renderers.c2d.shapes = ($) => {
|
|
|
1109
1111
|
// DRAWING
|
|
1110
1112
|
|
|
1111
1113
|
$.line = (x0, y0, x1, y1) => {
|
|
1112
|
-
if ($.
|
|
1114
|
+
if ($.__doStroke) {
|
|
1113
1115
|
$.ctx.beginPath();
|
|
1114
1116
|
$.ctx.moveTo(x0, y0);
|
|
1115
1117
|
$.ctx.lineTo(x1, y1);
|
|
@@ -1137,14 +1139,14 @@ Q5.renderers.c2d.shapes = ($) => {
|
|
|
1137
1139
|
w = Math.abs(w);
|
|
1138
1140
|
h = Math.abs(h);
|
|
1139
1141
|
|
|
1140
|
-
if (!$.
|
|
1142
|
+
if (!$.__doFill && mode == $.PIE_OPEN) mode = $.CHORD_OPEN;
|
|
1141
1143
|
|
|
1142
1144
|
$.ctx.beginPath();
|
|
1143
1145
|
$.ctx.ellipse(x, y, w, h, 0, lo, hi);
|
|
1144
1146
|
if (mode == $.PIE || mode == $.PIE_OPEN) $.ctx.lineTo(x, y);
|
|
1145
|
-
if ($.
|
|
1147
|
+
if ($.__doFill) $.ctx.fill();
|
|
1146
1148
|
|
|
1147
|
-
if ($.
|
|
1149
|
+
if ($.__doStroke) {
|
|
1148
1150
|
if (mode == $.PIE || mode == $.CHORD) $.ctx.closePath();
|
|
1149
1151
|
if (mode != $.PIE_OPEN) return $.ctx.stroke();
|
|
1150
1152
|
|
|
@@ -1198,7 +1200,7 @@ Q5.renderers.c2d.shapes = ($) => {
|
|
|
1198
1200
|
};
|
|
1199
1201
|
|
|
1200
1202
|
$.point = (x, y) => {
|
|
1201
|
-
if ($.
|
|
1203
|
+
if ($.__doStroke) {
|
|
1202
1204
|
if (x.x) {
|
|
1203
1205
|
y = x.y;
|
|
1204
1206
|
x = x.x;
|
|
@@ -2198,7 +2200,7 @@ Q5.renderers.c2d.text = ($, q) => {
|
|
|
2198
2200
|
let lines = [];
|
|
2199
2201
|
|
|
2200
2202
|
$.text = (str, x, y, w, h) => {
|
|
2201
|
-
if (str === undefined || (!$.
|
|
2203
|
+
if (str === undefined || (!$.__doFill && !$.__doStroke)) return;
|
|
2202
2204
|
str = str.toString();
|
|
2203
2205
|
let ctx = $.ctx;
|
|
2204
2206
|
let img, colorStyle, styleCache, colorCache, recycling;
|
|
@@ -2305,8 +2307,8 @@ Q5.renderers.c2d.text = ($, q) => {
|
|
|
2305
2307
|
else tX = 0;
|
|
2306
2308
|
|
|
2307
2309
|
ctx.font = $.ctx.font;
|
|
2308
|
-
if ($.
|
|
2309
|
-
if ($.
|
|
2310
|
+
if ($.__doFill && $._fillSet) ctx.fillStyle = $._fill;
|
|
2311
|
+
if ($.__doStroke && $._strokeSet) ctx.strokeStyle = $._stroke;
|
|
2310
2312
|
ctx.lineWidth = $.ctx.lineWidth;
|
|
2311
2313
|
}
|
|
2312
2314
|
|
|
@@ -2318,8 +2320,8 @@ Q5.renderers.c2d.text = ($, q) => {
|
|
|
2318
2320
|
|
|
2319
2321
|
let lineAmount = 0;
|
|
2320
2322
|
for (let line of lines) {
|
|
2321
|
-
if ($.
|
|
2322
|
-
if ($.
|
|
2323
|
+
if ($.__doStroke && $._strokeSet) ctx.strokeText(line, tX, tY);
|
|
2324
|
+
if ($.__doFill) ctx.fillText(line, tX, tY);
|
|
2323
2325
|
tY += leading;
|
|
2324
2326
|
lineAmount++;
|
|
2325
2327
|
if (lineAmount >= h) break;
|