@visactor/vrender-core 0.20.10-alpha.1 → 0.20.10
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/cjs/common/path-svg.js +3 -3
- package/cjs/common/path-svg.js.map +1 -1
- package/cjs/core/window.js +3 -2
- package/cjs/core/window.js.map +1 -1
- package/cjs/graphic/config.js +2 -0
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/interface/graphic.d.ts +1 -0
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/render/contributions/render/arc-render.js +30 -18
- package/cjs/render/contributions/render/arc-render.js.map +1 -1
- package/cjs/render/contributions/render/area-render.js +40 -36
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/circle-render.js +10 -5
- package/cjs/render/contributions/render/circle-render.js.map +1 -1
- package/cjs/render/contributions/render/group-render.js +10 -5
- package/cjs/render/contributions/render/group-render.js.map +1 -1
- package/cjs/render/contributions/render/image-render.js +26 -22
- package/cjs/render/contributions/render/image-render.js.map +1 -1
- package/cjs/render/contributions/render/path-render.js +10 -5
- package/cjs/render/contributions/render/path-render.js.map +1 -1
- package/cjs/render/contributions/render/polygon-render.js +10 -5
- package/cjs/render/contributions/render/polygon-render.js.map +1 -1
- package/cjs/render/contributions/render/rect-render.js +10 -5
- package/cjs/render/contributions/render/rect-render.js.map +1 -1
- package/cjs/render/contributions/render/symbol-render.js +18 -8
- package/cjs/render/contributions/render/symbol-render.js.map +1 -1
- package/dist/index.es.js +390 -250
- package/es/common/path-svg.js +3 -3
- package/es/common/path-svg.js.map +1 -1
- package/es/core/window.js +3 -1
- package/es/core/window.js.map +1 -1
- package/es/graphic/config.js +2 -0
- package/es/graphic/config.js.map +1 -1
- package/es/interface/graphic.d.ts +1 -0
- package/es/interface/graphic.js.map +1 -1
- package/es/render/contributions/render/arc-render.js +30 -18
- package/es/render/contributions/render/arc-render.js.map +1 -1
- package/es/render/contributions/render/area-render.js +40 -36
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/circle-render.js +10 -5
- package/es/render/contributions/render/circle-render.js.map +1 -1
- package/es/render/contributions/render/group-render.js +10 -5
- package/es/render/contributions/render/group-render.js.map +1 -1
- package/es/render/contributions/render/image-render.js +26 -22
- package/es/render/contributions/render/image-render.js.map +1 -1
- package/es/render/contributions/render/path-render.js +10 -5
- package/es/render/contributions/render/path-render.js.map +1 -1
- package/es/render/contributions/render/polygon-render.js +10 -5
- package/es/render/contributions/render/polygon-render.js.map +1 -1
- package/es/render/contributions/render/rect-render.js +10 -5
- package/es/render/contributions/render/rect-render.js.map +1 -1
- package/es/render/contributions/render/symbol-render.js +18 -8
- package/es/render/contributions/render/symbol-render.js.map +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, isPointInLine, pi, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, has, isUndefined, isArray, cos, sin, pointAt, isNumber, getDecimalPlaces, isValidNumber, clamp, getAngleByPoint,
|
|
1
|
+
import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, isPointInLine, pi, isNumberClose, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, has, isUndefined, isArray, cos, sin, pointAt, isNumber, getDecimalPlaces, isValidNumber, clamp, getAngleByPoint, isNil, Bounds, getIntersectPoint, Color, DEFAULT_COLORS, OBBBounds, normalTransform, isValidUrl, isBase64, acos, sqrt, LRU, lowerCamelCaseToMiddle, isValid, transformBoundsWithMatrix, arrayEqual, getContextFont, rotatePoint, clampAngleByRadian, asin, getRectIntersect, isRectIntersect, merge, calculateAnchorOfBounds, styleStringToObject } from '@visactor/vutils';
|
|
2
2
|
|
|
3
3
|
class Generator {
|
|
4
4
|
static GenAutoIncrementId() {
|
|
@@ -1351,12 +1351,19 @@ function parseSvgPath(str) {
|
|
|
1351
1351
|
standardCommandLen = commandLengths[commandChar];
|
|
1352
1352
|
if (currCommandData.length - 1 > standardCommandLen) {
|
|
1353
1353
|
let subCommand;
|
|
1354
|
+
let bestCommandChar = commandChar;
|
|
1354
1355
|
for (let i = 1, len = currCommandData.length; i < len; i += standardCommandLen) {
|
|
1355
|
-
subCommand = [
|
|
1356
|
+
subCommand = [bestCommandChar];
|
|
1356
1357
|
for (let j = i, subLen = i + standardCommandLen; j < subLen; j++) {
|
|
1357
1358
|
subCommand.push(currCommandData[j]);
|
|
1358
1359
|
}
|
|
1359
1360
|
result.push(subCommand);
|
|
1361
|
+
if (bestCommandChar === 'm') {
|
|
1362
|
+
bestCommandChar = 'l';
|
|
1363
|
+
}
|
|
1364
|
+
else if (bestCommandChar === 'M') {
|
|
1365
|
+
bestCommandChar = 'L';
|
|
1366
|
+
}
|
|
1360
1367
|
}
|
|
1361
1368
|
}
|
|
1362
1369
|
else {
|
|
@@ -3048,7 +3055,7 @@ const DefaultConnectAttribute = {
|
|
|
3048
3055
|
const DefaultDebugAttribute = {
|
|
3049
3056
|
_debug_bounds: false
|
|
3050
3057
|
};
|
|
3051
|
-
const DefaultAttribute = Object.assign(Object.assign(Object.assign({ strokeSeg: null, renderable: true, pickable: true, shadowGraphic: undefined, childrenPickable: true, fillPickable: true, strokePickable: true, visible: true, zIndex: 0, layout: null, boundsPadding: 0, renderStyle: 'default', pickMode: 'accurate', customPickShape: null, boundsMode: 'accurate', keepDirIn3d: true, shadowRootIdx: 1, globalZIndex: 1, globalCompositeOperation: '', overflow: 'hidden', shadowPickMode: 'graphic' }, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
|
|
3058
|
+
const DefaultAttribute = Object.assign(Object.assign(Object.assign({ strokeSeg: null, renderable: true, pickable: true, shadowGraphic: undefined, childrenPickable: true, fillPickable: true, strokePickable: true, visible: true, zIndex: 0, layout: null, boundsPadding: 0, fillStrokeOrder: 0, renderStyle: 'default', pickMode: 'accurate', customPickShape: null, boundsMode: 'accurate', keepDirIn3d: true, shadowRootIdx: 1, globalZIndex: 1, globalCompositeOperation: '', overflow: 'hidden', shadowPickMode: 'graphic' }, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
|
|
3052
3059
|
function addAttributeToPrototype(obj, c, keys) {
|
|
3053
3060
|
keys.forEach(key => {
|
|
3054
3061
|
c.prototype[key] = obj[key];
|
|
@@ -3063,7 +3070,7 @@ const DefaultCircleAttribute = Object.assign(Object.assign({}, DefaultAttribute)
|
|
|
3063
3070
|
const DefaultGroupAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, cornerRadius: 0, path: [], clip: false, visibleAll: true, display: 'relative', flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'flex-start', alignItems: 'flex-start', alignContent: 'flex-start', baseOpacity: 1 });
|
|
3064
3071
|
const DefaultGlyphAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: '', width: 0, height: 0, cornerRadius: 0, clip: false });
|
|
3065
3072
|
const DefaultLineAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: 'linear', clipRange: 1, clipRangeByDimension: 'default', closePath: false, curveTension: 1 });
|
|
3066
|
-
const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: new CustomPath2D(), customPath: () => {
|
|
3073
|
+
const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: new CustomPath2D(), fillStrokeOrder: 1, customPath: () => {
|
|
3067
3074
|
Logger.getInstance().warn('空函数');
|
|
3068
3075
|
} });
|
|
3069
3076
|
const DefaultPolygonAttribute = Object.assign(Object.assign({}, DefaultAttribute), { points: [], cornerRadius: 0, closePath: true });
|
|
@@ -4446,8 +4453,8 @@ let DefaultWindow = class DefaultWindow {
|
|
|
4446
4453
|
const viewBox = this._handler.getViewBox();
|
|
4447
4454
|
return !(viewBox.x1 === 0 &&
|
|
4448
4455
|
viewBox.y1 === 0 &&
|
|
4449
|
-
this.width
|
|
4450
|
-
this.height
|
|
4456
|
+
isNumberClose(this.width, viewBox.width()) &&
|
|
4457
|
+
isNumberClose(this.height, viewBox.height()));
|
|
4451
4458
|
}
|
|
4452
4459
|
isVisible(bbox) {
|
|
4453
4460
|
return this._handler.isVisible(bbox);
|
|
@@ -16004,7 +16011,7 @@ let DefaultCanvasArcRender = class DefaultCanvasArcRender extends BaseRender {
|
|
|
16004
16011
|
}
|
|
16005
16012
|
drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
16006
16013
|
const arcAttribute = getTheme(arc, params === null || params === void 0 ? void 0 : params.theme).arc;
|
|
16007
|
-
const { fill = arcAttribute.fill, stroke = arcAttribute.stroke, x: originX = arcAttribute.x, y: originY = arcAttribute.y } = arc.attribute;
|
|
16014
|
+
const { fill = arcAttribute.fill, stroke = arcAttribute.stroke, x: originX = arcAttribute.x, y: originY = arcAttribute.y, fillStrokeOrder = arcAttribute.fillStrokeOrder } = arc.attribute;
|
|
16008
16015
|
const data = this.valid(arc, arcAttribute, fillCb, strokeCb);
|
|
16009
16016
|
if (!data) {
|
|
16010
16017
|
return;
|
|
@@ -16032,23 +16039,35 @@ let DefaultCanvasArcRender = class DefaultCanvasArcRender extends BaseRender {
|
|
|
16032
16039
|
beforeRenderContribitionsRuned = true;
|
|
16033
16040
|
context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute);
|
|
16034
16041
|
this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
|
|
16035
|
-
|
|
16036
|
-
if (
|
|
16037
|
-
fillCb
|
|
16042
|
+
const _runFill = () => {
|
|
16043
|
+
if (doFill) {
|
|
16044
|
+
if (fillCb) {
|
|
16045
|
+
fillCb(context, arc.attribute, arcAttribute);
|
|
16046
|
+
}
|
|
16047
|
+
else if (fVisible) {
|
|
16048
|
+
context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute);
|
|
16049
|
+
context.fill();
|
|
16050
|
+
}
|
|
16038
16051
|
}
|
|
16039
|
-
|
|
16040
|
-
|
|
16041
|
-
|
|
16052
|
+
};
|
|
16053
|
+
const _runStroke = () => {
|
|
16054
|
+
if (doStroke && isFullStroke) {
|
|
16055
|
+
if (strokeCb) {
|
|
16056
|
+
strokeCb(context, arc.attribute, arcAttribute);
|
|
16057
|
+
}
|
|
16058
|
+
else if (sVisible) {
|
|
16059
|
+
context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute);
|
|
16060
|
+
context.stroke();
|
|
16061
|
+
}
|
|
16042
16062
|
}
|
|
16063
|
+
};
|
|
16064
|
+
if (!fillStrokeOrder) {
|
|
16065
|
+
_runFill();
|
|
16066
|
+
_runStroke();
|
|
16043
16067
|
}
|
|
16044
|
-
|
|
16045
|
-
|
|
16046
|
-
|
|
16047
|
-
}
|
|
16048
|
-
else if (sVisible) {
|
|
16049
|
-
context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute);
|
|
16050
|
-
context.stroke();
|
|
16051
|
-
}
|
|
16068
|
+
else {
|
|
16069
|
+
_runStroke();
|
|
16070
|
+
_runFill();
|
|
16052
16071
|
}
|
|
16053
16072
|
}
|
|
16054
16073
|
if (!isFullStroke && doStroke) {
|
|
@@ -16078,24 +16097,36 @@ let DefaultCanvasArcRender = class DefaultCanvasArcRender extends BaseRender {
|
|
|
16078
16097
|
if (!beforeRenderContribitionsRuned) {
|
|
16079
16098
|
this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
|
|
16080
16099
|
}
|
|
16081
|
-
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
|
|
16087
|
-
|
|
16088
|
-
|
|
16089
|
-
|
|
16100
|
+
const _runFill = () => {
|
|
16101
|
+
if (doFill) {
|
|
16102
|
+
const color = fill;
|
|
16103
|
+
if (color.gradient === 'conical') {
|
|
16104
|
+
const lastColor = getConicGradientAt(0, 0, endAngle, color);
|
|
16105
|
+
if (fillCb) ;
|
|
16106
|
+
else if (fillVisible) {
|
|
16107
|
+
context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute);
|
|
16108
|
+
context.fillStyle = lastColor;
|
|
16109
|
+
context.fill();
|
|
16110
|
+
}
|
|
16090
16111
|
}
|
|
16091
16112
|
}
|
|
16092
|
-
}
|
|
16093
|
-
|
|
16094
|
-
if (
|
|
16095
|
-
|
|
16096
|
-
|
|
16097
|
-
|
|
16113
|
+
};
|
|
16114
|
+
const _runStroke = () => {
|
|
16115
|
+
if (doStroke) {
|
|
16116
|
+
if (strokeCb) ;
|
|
16117
|
+
else if (sVisible) {
|
|
16118
|
+
context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute);
|
|
16119
|
+
context.stroke();
|
|
16120
|
+
}
|
|
16098
16121
|
}
|
|
16122
|
+
};
|
|
16123
|
+
if (!fillStrokeOrder) {
|
|
16124
|
+
_runFill();
|
|
16125
|
+
_runStroke();
|
|
16126
|
+
}
|
|
16127
|
+
else {
|
|
16128
|
+
_runFill();
|
|
16129
|
+
_runStroke();
|
|
16099
16130
|
}
|
|
16100
16131
|
}
|
|
16101
16132
|
}
|
|
@@ -16131,7 +16162,7 @@ let DefaultCanvasCircleRender = class DefaultCanvasCircleRender extends BaseRend
|
|
|
16131
16162
|
}
|
|
16132
16163
|
drawShape(circle, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
16133
16164
|
const circleAttribute = getTheme(circle, params === null || params === void 0 ? void 0 : params.theme).circle;
|
|
16134
|
-
const { radius = circleAttribute.radius, startAngle = circleAttribute.startAngle, endAngle = circleAttribute.endAngle, x: originX = circleAttribute.x, y: originY = circleAttribute.y } = circle.attribute;
|
|
16165
|
+
const { radius = circleAttribute.radius, startAngle = circleAttribute.startAngle, endAngle = circleAttribute.endAngle, x: originX = circleAttribute.x, y: originY = circleAttribute.y, fillStrokeOrder = circleAttribute.fillStrokeOrder } = circle.attribute;
|
|
16135
16166
|
const data = this.valid(circle, circleAttribute, fillCb, strokeCb);
|
|
16136
16167
|
if (!data) {
|
|
16137
16168
|
return;
|
|
@@ -16142,23 +16173,35 @@ let DefaultCanvasCircleRender = class DefaultCanvasCircleRender extends BaseRend
|
|
|
16142
16173
|
context.closePath();
|
|
16143
16174
|
context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute);
|
|
16144
16175
|
this.beforeRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
|
|
16145
|
-
|
|
16146
|
-
if (
|
|
16147
|
-
fillCb
|
|
16176
|
+
const _runFill = () => {
|
|
16177
|
+
if (doFill) {
|
|
16178
|
+
if (fillCb) {
|
|
16179
|
+
fillCb(context, circle.attribute, circleAttribute);
|
|
16180
|
+
}
|
|
16181
|
+
else if (fVisible) {
|
|
16182
|
+
context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute);
|
|
16183
|
+
context.fill();
|
|
16184
|
+
}
|
|
16148
16185
|
}
|
|
16149
|
-
|
|
16150
|
-
|
|
16151
|
-
|
|
16186
|
+
};
|
|
16187
|
+
const _runStroke = () => {
|
|
16188
|
+
if (doStroke) {
|
|
16189
|
+
if (strokeCb) {
|
|
16190
|
+
strokeCb(context, circle.attribute, circleAttribute);
|
|
16191
|
+
}
|
|
16192
|
+
else if (sVisible) {
|
|
16193
|
+
context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute);
|
|
16194
|
+
context.stroke();
|
|
16195
|
+
}
|
|
16152
16196
|
}
|
|
16197
|
+
};
|
|
16198
|
+
if (!fillStrokeOrder) {
|
|
16199
|
+
_runFill();
|
|
16200
|
+
_runStroke();
|
|
16153
16201
|
}
|
|
16154
|
-
|
|
16155
|
-
|
|
16156
|
-
|
|
16157
|
-
}
|
|
16158
|
-
else if (sVisible) {
|
|
16159
|
-
context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute);
|
|
16160
|
-
context.stroke();
|
|
16161
|
-
}
|
|
16202
|
+
else {
|
|
16203
|
+
_runStroke();
|
|
16204
|
+
_runFill();
|
|
16162
16205
|
}
|
|
16163
16206
|
this.afterRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
|
|
16164
16207
|
}
|
|
@@ -16916,7 +16959,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
16916
16959
|
this.init(areaRenderContribitions);
|
|
16917
16960
|
}
|
|
16918
16961
|
drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
|
|
16919
|
-
var _a, _b, _c
|
|
16962
|
+
var _a, _b, _c;
|
|
16920
16963
|
const { points } = area.attribute;
|
|
16921
16964
|
if (points.length < 2) {
|
|
16922
16965
|
return;
|
|
@@ -16937,44 +16980,51 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
16937
16980
|
context.setShadowBlendStyle && context.setShadowBlendStyle(area, area.attribute, areaAttribute);
|
|
16938
16981
|
this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, false, fill, false, areaAttribute, drawContext, fillCb, null, { attribute: area.attribute });
|
|
16939
16982
|
const { x: originX = 0, x: originY = 0 } = area.attribute;
|
|
16940
|
-
|
|
16941
|
-
if (
|
|
16942
|
-
fillCb
|
|
16943
|
-
|
|
16944
|
-
|
|
16945
|
-
|
|
16946
|
-
|
|
16983
|
+
const _runFill = () => {
|
|
16984
|
+
if (fill !== false) {
|
|
16985
|
+
if (fillCb) {
|
|
16986
|
+
fillCb(context, area.attribute, areaAttribute);
|
|
16987
|
+
}
|
|
16988
|
+
else if (fillOpacity) {
|
|
16989
|
+
context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute);
|
|
16990
|
+
context.fill();
|
|
16991
|
+
}
|
|
16947
16992
|
}
|
|
16948
|
-
}
|
|
16949
|
-
|
|
16950
|
-
|
|
16951
|
-
|
|
16952
|
-
|
|
16953
|
-
|
|
16954
|
-
|
|
16955
|
-
|
|
16956
|
-
|
|
16957
|
-
|
|
16958
|
-
|
|
16993
|
+
};
|
|
16994
|
+
const _runStroke = () => {
|
|
16995
|
+
var _a, _b;
|
|
16996
|
+
if (stroke) {
|
|
16997
|
+
const { stroke = areaAttribute && areaAttribute.stroke } = area.attribute;
|
|
16998
|
+
if (isArray(stroke) && (stroke[0] || stroke[2]) && stroke[1] === false) {
|
|
16999
|
+
context.beginPath();
|
|
17000
|
+
if (stroke[0]) {
|
|
17001
|
+
context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
|
|
17002
|
+
for (let i = 1; i < points.length; i++) {
|
|
17003
|
+
const p = points[i];
|
|
17004
|
+
context.lineTo(p.x + offsetX, p.y + offsetY, z);
|
|
17005
|
+
}
|
|
16959
17006
|
}
|
|
16960
|
-
|
|
16961
|
-
|
|
16962
|
-
|
|
16963
|
-
|
|
16964
|
-
|
|
16965
|
-
|
|
16966
|
-
|
|
17007
|
+
else if (stroke[2]) {
|
|
17008
|
+
const endP = points[points.length - 1];
|
|
17009
|
+
context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
|
|
17010
|
+
for (let i = points.length - 2; i >= 0; i--) {
|
|
17011
|
+
const p = points[i];
|
|
17012
|
+
context.lineTo(((_a = p.x1) !== null && _a !== void 0 ? _a : p.x) + offsetX, ((_b = p.y1) !== null && _b !== void 0 ? _b : p.y) + offsetY, z);
|
|
17013
|
+
}
|
|
16967
17014
|
}
|
|
16968
17015
|
}
|
|
17016
|
+
if (strokeCb) {
|
|
17017
|
+
strokeCb(context, area.attribute, areaAttribute);
|
|
17018
|
+
}
|
|
17019
|
+
else {
|
|
17020
|
+
context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute);
|
|
17021
|
+
context.stroke();
|
|
17022
|
+
}
|
|
16969
17023
|
}
|
|
16970
|
-
|
|
16971
|
-
|
|
16972
|
-
|
|
16973
|
-
|
|
16974
|
-
context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute);
|
|
16975
|
-
context.stroke();
|
|
16976
|
-
}
|
|
16977
|
-
}
|
|
17024
|
+
};
|
|
17025
|
+
_runFill();
|
|
17026
|
+
this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, false, fill, false, areaAttribute, drawContext, fillCb, null, { attribute: area.attribute });
|
|
17027
|
+
_runStroke();
|
|
16978
17028
|
}
|
|
16979
17029
|
drawShape(area, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
16980
17030
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -17204,38 +17254,44 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
17204
17254
|
this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, false, fill, false, defaultAttribute, drawContext, fillCb, null, { attribute });
|
|
17205
17255
|
context.setShadowBlendStyle && context.setShadowBlendStyle(area, attribute, defaultAttribute);
|
|
17206
17256
|
const { x: originX = 0, x: originY = 0 } = attribute;
|
|
17207
|
-
|
|
17208
|
-
if (
|
|
17209
|
-
fillCb
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
|
|
17215
|
-
|
|
17216
|
-
this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, false, fill, false, defaultAttribute, drawContext, fillCb, null, { attribute });
|
|
17217
|
-
if (stroke !== false) {
|
|
17218
|
-
if (strokeCb) {
|
|
17219
|
-
strokeCb(context, attribute, defaultAttribute);
|
|
17257
|
+
const _runFill = () => {
|
|
17258
|
+
if (fill !== false) {
|
|
17259
|
+
if (fillCb) {
|
|
17260
|
+
fillCb(context, attribute, defaultAttribute);
|
|
17261
|
+
}
|
|
17262
|
+
else if (fillOpacity) {
|
|
17263
|
+
context.setCommonStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute);
|
|
17264
|
+
context.fill();
|
|
17265
|
+
}
|
|
17220
17266
|
}
|
|
17221
|
-
|
|
17222
|
-
|
|
17223
|
-
|
|
17224
|
-
|
|
17225
|
-
|
|
17226
|
-
|
|
17227
|
-
|
|
17228
|
-
|
|
17229
|
-
|
|
17230
|
-
|
|
17231
|
-
|
|
17232
|
-
|
|
17233
|
-
|
|
17267
|
+
};
|
|
17268
|
+
const _runStroke = () => {
|
|
17269
|
+
if (stroke !== false) {
|
|
17270
|
+
if (strokeCb) {
|
|
17271
|
+
strokeCb(context, attribute, defaultAttribute);
|
|
17272
|
+
}
|
|
17273
|
+
else {
|
|
17274
|
+
const { stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke } = attribute;
|
|
17275
|
+
if (isArray(stroke) && (stroke[0] || stroke[2]) && stroke[1] === false) {
|
|
17276
|
+
context.beginPath();
|
|
17277
|
+
drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction$1.ROW ? 'x' : 'y', {
|
|
17278
|
+
offsetX,
|
|
17279
|
+
offsetY,
|
|
17280
|
+
offsetZ,
|
|
17281
|
+
drawConnect: connect,
|
|
17282
|
+
mode: connectedType,
|
|
17283
|
+
zeroX: connectedX,
|
|
17284
|
+
zeroY: connectedY
|
|
17285
|
+
});
|
|
17286
|
+
}
|
|
17287
|
+
context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute);
|
|
17288
|
+
context.stroke();
|
|
17234
17289
|
}
|
|
17235
|
-
context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute);
|
|
17236
|
-
context.stroke();
|
|
17237
17290
|
}
|
|
17238
|
-
}
|
|
17291
|
+
};
|
|
17292
|
+
_runFill();
|
|
17293
|
+
this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, false, fill, false, defaultAttribute, drawContext, fillCb, null, { attribute });
|
|
17294
|
+
_runStroke();
|
|
17239
17295
|
return ret;
|
|
17240
17296
|
}
|
|
17241
17297
|
};
|
|
@@ -17260,7 +17316,7 @@ let DefaultCanvasPathRender = class DefaultCanvasPathRender extends BaseRender {
|
|
|
17260
17316
|
drawShape(path, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17261
17317
|
var _a, _b, _c;
|
|
17262
17318
|
const pathAttribute = (_a = this.tempTheme) !== null && _a !== void 0 ? _a : getTheme(path, params === null || params === void 0 ? void 0 : params.theme).path;
|
|
17263
|
-
const { x: originX = pathAttribute.x, y: originY = pathAttribute.y } = path.attribute;
|
|
17319
|
+
const { x: originX = pathAttribute.x, y: originY = pathAttribute.y, fillStrokeOrder = pathAttribute.fillStrokeOrder } = path.attribute;
|
|
17264
17320
|
const z = (_b = this.z) !== null && _b !== void 0 ? _b : 0;
|
|
17265
17321
|
const data = this.valid(path, pathAttribute, fillCb, strokeCb);
|
|
17266
17322
|
if (!data) {
|
|
@@ -17277,23 +17333,35 @@ let DefaultCanvasPathRender = class DefaultCanvasPathRender extends BaseRender {
|
|
|
17277
17333
|
}
|
|
17278
17334
|
context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute);
|
|
17279
17335
|
this.beforeRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
|
|
17280
|
-
|
|
17281
|
-
if (
|
|
17282
|
-
strokeCb
|
|
17336
|
+
const _runStroke = () => {
|
|
17337
|
+
if (doStroke) {
|
|
17338
|
+
if (strokeCb) {
|
|
17339
|
+
strokeCb(context, path.attribute, pathAttribute);
|
|
17340
|
+
}
|
|
17341
|
+
else if (sVisible) {
|
|
17342
|
+
context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute);
|
|
17343
|
+
context.stroke();
|
|
17344
|
+
}
|
|
17283
17345
|
}
|
|
17284
|
-
|
|
17285
|
-
|
|
17286
|
-
|
|
17346
|
+
};
|
|
17347
|
+
const _runFill = () => {
|
|
17348
|
+
if (doFill) {
|
|
17349
|
+
if (fillCb) {
|
|
17350
|
+
fillCb(context, path.attribute, pathAttribute);
|
|
17351
|
+
}
|
|
17352
|
+
else if (fVisible) {
|
|
17353
|
+
context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute);
|
|
17354
|
+
context.fill();
|
|
17355
|
+
}
|
|
17287
17356
|
}
|
|
17357
|
+
};
|
|
17358
|
+
if (!fillStrokeOrder) {
|
|
17359
|
+
_runFill();
|
|
17360
|
+
_runStroke();
|
|
17288
17361
|
}
|
|
17289
|
-
|
|
17290
|
-
|
|
17291
|
-
|
|
17292
|
-
}
|
|
17293
|
-
else if (fVisible) {
|
|
17294
|
-
context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute);
|
|
17295
|
-
context.fill();
|
|
17296
|
-
}
|
|
17362
|
+
else {
|
|
17363
|
+
_runStroke();
|
|
17364
|
+
_runFill();
|
|
17297
17365
|
}
|
|
17298
17366
|
this.afterRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
|
|
17299
17367
|
}
|
|
@@ -17327,7 +17395,7 @@ let DefaultCanvasRectRender = class DefaultCanvasRectRender extends BaseRender {
|
|
|
17327
17395
|
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17328
17396
|
var _a;
|
|
17329
17397
|
const rectAttribute = (_a = this.tempTheme) !== null && _a !== void 0 ? _a : getTheme(rect, params === null || params === void 0 ? void 0 : params.theme).rect;
|
|
17330
|
-
const { fill = rectAttribute.fill, background, stroke = rectAttribute.stroke, cornerRadius = rectAttribute.cornerRadius, opacity = rectAttribute.opacity, fillOpacity = rectAttribute.fillOpacity, lineWidth = rectAttribute.lineWidth, strokeOpacity = rectAttribute.strokeOpacity, visible = rectAttribute.visible, x1, y1, x: originX = rectAttribute.x, y: originY = rectAttribute.y } = rect.attribute;
|
|
17398
|
+
const { fill = rectAttribute.fill, background, stroke = rectAttribute.stroke, cornerRadius = rectAttribute.cornerRadius, opacity = rectAttribute.opacity, fillOpacity = rectAttribute.fillOpacity, lineWidth = rectAttribute.lineWidth, strokeOpacity = rectAttribute.strokeOpacity, visible = rectAttribute.visible, x1, y1, x: originX = rectAttribute.x, y: originY = rectAttribute.y, fillStrokeOrder = rectAttribute.fillStrokeOrder } = rect.attribute;
|
|
17331
17399
|
let { width, height } = rect.attribute;
|
|
17332
17400
|
width = (width !== null && width !== void 0 ? width : x1 - originX) || 0;
|
|
17333
17401
|
height = (height !== null && height !== void 0 ? height : y1 - originY) || 0;
|
|
@@ -17358,23 +17426,35 @@ let DefaultCanvasRectRender = class DefaultCanvasRectRender extends BaseRender {
|
|
|
17358
17426
|
};
|
|
17359
17427
|
context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);
|
|
17360
17428
|
this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
|
|
17361
|
-
|
|
17362
|
-
if (
|
|
17363
|
-
fillCb
|
|
17429
|
+
const _runFill = () => {
|
|
17430
|
+
if (doFillOrStroke.doFill) {
|
|
17431
|
+
if (fillCb) {
|
|
17432
|
+
fillCb(context, rect.attribute, rectAttribute);
|
|
17433
|
+
}
|
|
17434
|
+
else if (fVisible) {
|
|
17435
|
+
context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute);
|
|
17436
|
+
context.fill();
|
|
17437
|
+
}
|
|
17364
17438
|
}
|
|
17365
|
-
|
|
17366
|
-
|
|
17367
|
-
|
|
17439
|
+
};
|
|
17440
|
+
const _runStroke = () => {
|
|
17441
|
+
if (doFillOrStroke.doStroke) {
|
|
17442
|
+
if (strokeCb) {
|
|
17443
|
+
strokeCb(context, rect.attribute, rectAttribute);
|
|
17444
|
+
}
|
|
17445
|
+
else if (sVisible) {
|
|
17446
|
+
context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute);
|
|
17447
|
+
context.stroke();
|
|
17448
|
+
}
|
|
17368
17449
|
}
|
|
17450
|
+
};
|
|
17451
|
+
if (!fillStrokeOrder) {
|
|
17452
|
+
_runFill();
|
|
17453
|
+
_runStroke();
|
|
17369
17454
|
}
|
|
17370
|
-
|
|
17371
|
-
|
|
17372
|
-
|
|
17373
|
-
}
|
|
17374
|
-
else if (sVisible) {
|
|
17375
|
-
context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute);
|
|
17376
|
-
context.stroke();
|
|
17377
|
-
}
|
|
17455
|
+
else {
|
|
17456
|
+
_runStroke();
|
|
17457
|
+
_runFill();
|
|
17378
17458
|
}
|
|
17379
17459
|
this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
17380
17460
|
}
|
|
@@ -17407,7 +17487,7 @@ let DefaultCanvasSymbolRender = class DefaultCanvasSymbolRender extends BaseRend
|
|
|
17407
17487
|
drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17408
17488
|
var _a;
|
|
17409
17489
|
const symbolAttribute = getTheme(symbol, params === null || params === void 0 ? void 0 : params.theme).symbol;
|
|
17410
|
-
const { size = symbolAttribute.size, x: originX = symbolAttribute.x, y: originY = symbolAttribute.y, scaleX = symbolAttribute.scaleX, scaleY = symbolAttribute.scaleY } = symbol.attribute;
|
|
17490
|
+
const { size = symbolAttribute.size, x: originX = symbolAttribute.x, y: originY = symbolAttribute.y, scaleX = symbolAttribute.scaleX, scaleY = symbolAttribute.scaleY, fillStrokeOrder = symbolAttribute.fillStrokeOrder } = symbol.attribute;
|
|
17411
17491
|
const data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);
|
|
17412
17492
|
if (!data) {
|
|
17413
17493
|
return;
|
|
@@ -17430,23 +17510,35 @@ let DefaultCanvasSymbolRender = class DefaultCanvasSymbolRender extends BaseRend
|
|
|
17430
17510
|
obj.stroke = (_c = a.stroke) !== null && _c !== void 0 ? _c : symbol.attribute.stroke;
|
|
17431
17511
|
a = obj;
|
|
17432
17512
|
}
|
|
17433
|
-
|
|
17434
|
-
if (
|
|
17435
|
-
fillCb
|
|
17513
|
+
const _runFill = () => {
|
|
17514
|
+
if (a.fill) {
|
|
17515
|
+
if (fillCb) {
|
|
17516
|
+
fillCb(context, symbol.attribute, symbolAttribute);
|
|
17517
|
+
}
|
|
17518
|
+
else {
|
|
17519
|
+
context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute);
|
|
17520
|
+
context.fill();
|
|
17521
|
+
}
|
|
17436
17522
|
}
|
|
17437
|
-
|
|
17438
|
-
|
|
17439
|
-
|
|
17523
|
+
};
|
|
17524
|
+
const _runStroke = () => {
|
|
17525
|
+
if (a.stroke) {
|
|
17526
|
+
if (strokeCb) {
|
|
17527
|
+
strokeCb(context, symbol.attribute, symbolAttribute);
|
|
17528
|
+
}
|
|
17529
|
+
else {
|
|
17530
|
+
context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);
|
|
17531
|
+
context.stroke();
|
|
17532
|
+
}
|
|
17440
17533
|
}
|
|
17534
|
+
};
|
|
17535
|
+
if (!fillStrokeOrder) {
|
|
17536
|
+
_runFill();
|
|
17537
|
+
_runStroke();
|
|
17441
17538
|
}
|
|
17442
|
-
|
|
17443
|
-
|
|
17444
|
-
|
|
17445
|
-
}
|
|
17446
|
-
else {
|
|
17447
|
-
context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);
|
|
17448
|
-
context.stroke();
|
|
17449
|
-
}
|
|
17539
|
+
else {
|
|
17540
|
+
_runStroke();
|
|
17541
|
+
_runFill();
|
|
17450
17542
|
}
|
|
17451
17543
|
};
|
|
17452
17544
|
if (keepDirIn3d && context.camera && context.project) {
|
|
@@ -17465,23 +17557,35 @@ let DefaultCanvasSymbolRender = class DefaultCanvasSymbolRender extends BaseRend
|
|
|
17465
17557
|
}
|
|
17466
17558
|
context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute);
|
|
17467
17559
|
this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
|
|
17468
|
-
|
|
17469
|
-
if (
|
|
17470
|
-
fillCb
|
|
17560
|
+
const _runFill = () => {
|
|
17561
|
+
if (doFill && !parsedPath.isSvg) {
|
|
17562
|
+
if (fillCb) {
|
|
17563
|
+
fillCb(context, symbol.attribute, symbolAttribute);
|
|
17564
|
+
}
|
|
17565
|
+
else if (fVisible) {
|
|
17566
|
+
context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute);
|
|
17567
|
+
context.fill();
|
|
17568
|
+
}
|
|
17471
17569
|
}
|
|
17472
|
-
|
|
17473
|
-
|
|
17474
|
-
|
|
17570
|
+
};
|
|
17571
|
+
const _runStroke = () => {
|
|
17572
|
+
if (doStroke && !parsedPath.isSvg) {
|
|
17573
|
+
if (strokeCb) {
|
|
17574
|
+
strokeCb(context, symbol.attribute, symbolAttribute);
|
|
17575
|
+
}
|
|
17576
|
+
else if (sVisible) {
|
|
17577
|
+
context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);
|
|
17578
|
+
context.stroke();
|
|
17579
|
+
}
|
|
17475
17580
|
}
|
|
17581
|
+
};
|
|
17582
|
+
if (!fillStrokeOrder) {
|
|
17583
|
+
_runFill();
|
|
17584
|
+
_runStroke();
|
|
17476
17585
|
}
|
|
17477
|
-
|
|
17478
|
-
|
|
17479
|
-
|
|
17480
|
-
}
|
|
17481
|
-
else if (sVisible) {
|
|
17482
|
-
context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);
|
|
17483
|
-
context.stroke();
|
|
17484
|
-
}
|
|
17586
|
+
else {
|
|
17587
|
+
_runStroke();
|
|
17588
|
+
_runFill();
|
|
17485
17589
|
}
|
|
17486
17590
|
this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
|
|
17487
17591
|
}
|
|
@@ -18006,7 +18110,7 @@ let DefaultCanvasPolygonRender = class DefaultCanvasPolygonRender extends BaseRe
|
|
|
18006
18110
|
}
|
|
18007
18111
|
drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
18008
18112
|
const polygonAttribute = getTheme(polygon, params === null || params === void 0 ? void 0 : params.theme).polygon;
|
|
18009
|
-
const { points = polygonAttribute.points, cornerRadius = polygonAttribute.cornerRadius, x: originX = polygonAttribute.x, y: originY = polygonAttribute.y, closePath = polygonAttribute.closePath } = polygon.attribute;
|
|
18113
|
+
const { points = polygonAttribute.points, cornerRadius = polygonAttribute.cornerRadius, x: originX = polygonAttribute.x, y: originY = polygonAttribute.y, closePath = polygonAttribute.closePath, fillStrokeOrder = polygonAttribute.fillStrokeOrder } = polygon.attribute;
|
|
18010
18114
|
const data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);
|
|
18011
18115
|
if (!data) {
|
|
18012
18116
|
return;
|
|
@@ -18022,23 +18126,35 @@ let DefaultCanvasPolygonRender = class DefaultCanvasPolygonRender extends BaseRe
|
|
|
18022
18126
|
closePath && context.closePath();
|
|
18023
18127
|
context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute);
|
|
18024
18128
|
this.beforeRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
|
|
18025
|
-
|
|
18026
|
-
if (
|
|
18027
|
-
fillCb
|
|
18129
|
+
const _runFill = () => {
|
|
18130
|
+
if (doFill) {
|
|
18131
|
+
if (fillCb) {
|
|
18132
|
+
fillCb(context, polygon.attribute, polygonAttribute);
|
|
18133
|
+
}
|
|
18134
|
+
else if (fVisible) {
|
|
18135
|
+
context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);
|
|
18136
|
+
context.fill();
|
|
18137
|
+
}
|
|
18028
18138
|
}
|
|
18029
|
-
|
|
18030
|
-
|
|
18031
|
-
|
|
18139
|
+
};
|
|
18140
|
+
const _runStroke = () => {
|
|
18141
|
+
if (doStroke) {
|
|
18142
|
+
if (strokeCb) {
|
|
18143
|
+
strokeCb(context, polygon.attribute, polygonAttribute);
|
|
18144
|
+
}
|
|
18145
|
+
else if (sVisible) {
|
|
18146
|
+
context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);
|
|
18147
|
+
context.stroke();
|
|
18148
|
+
}
|
|
18032
18149
|
}
|
|
18150
|
+
};
|
|
18151
|
+
if (!fillStrokeOrder) {
|
|
18152
|
+
_runFill();
|
|
18153
|
+
_runStroke();
|
|
18033
18154
|
}
|
|
18034
|
-
|
|
18035
|
-
|
|
18036
|
-
|
|
18037
|
-
}
|
|
18038
|
-
else if (sVisible) {
|
|
18039
|
-
context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);
|
|
18040
|
-
context.stroke();
|
|
18041
|
-
}
|
|
18155
|
+
else {
|
|
18156
|
+
_runStroke();
|
|
18157
|
+
_runFill();
|
|
18042
18158
|
}
|
|
18043
18159
|
this.afterRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
|
|
18044
18160
|
}
|
|
@@ -18061,7 +18177,7 @@ let DefaultCanvasGroupRender = class DefaultCanvasGroupRender {
|
|
|
18061
18177
|
}
|
|
18062
18178
|
drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
18063
18179
|
const groupAttribute = getTheme(group, params === null || params === void 0 ? void 0 : params.theme).group;
|
|
18064
|
-
const { fill = groupAttribute.fill, background, stroke = groupAttribute.stroke, opacity = groupAttribute.opacity, width = groupAttribute.width, height = groupAttribute.height, clip = groupAttribute.clip, fillOpacity = groupAttribute.fillOpacity, strokeOpacity = groupAttribute.strokeOpacity, cornerRadius = groupAttribute.cornerRadius, path = groupAttribute.path, lineWidth = groupAttribute.lineWidth, visible = groupAttribute.visible } = group.attribute;
|
|
18180
|
+
const { fill = groupAttribute.fill, background, stroke = groupAttribute.stroke, opacity = groupAttribute.opacity, width = groupAttribute.width, height = groupAttribute.height, clip = groupAttribute.clip, fillOpacity = groupAttribute.fillOpacity, strokeOpacity = groupAttribute.strokeOpacity, cornerRadius = groupAttribute.cornerRadius, path = groupAttribute.path, lineWidth = groupAttribute.lineWidth, visible = groupAttribute.visible, fillStrokeOrder = groupAttribute.fillStrokeOrder } = group.attribute;
|
|
18065
18181
|
const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);
|
|
18066
18182
|
const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);
|
|
18067
18183
|
const doFill = runFill(fill, background);
|
|
@@ -18117,23 +18233,35 @@ let DefaultCanvasGroupRender = class DefaultCanvasGroupRender {
|
|
|
18117
18233
|
context.clip();
|
|
18118
18234
|
}
|
|
18119
18235
|
context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);
|
|
18120
|
-
|
|
18121
|
-
if (
|
|
18122
|
-
fillCb
|
|
18236
|
+
const _runFill = () => {
|
|
18237
|
+
if (doFillOrStroke.doFill) {
|
|
18238
|
+
if (fillCb) {
|
|
18239
|
+
fillCb(context, group.attribute, groupAttribute);
|
|
18240
|
+
}
|
|
18241
|
+
else if (fVisible) {
|
|
18242
|
+
context.setCommonStyle(group, group.attribute, x, y, groupAttribute);
|
|
18243
|
+
context.fill();
|
|
18244
|
+
}
|
|
18123
18245
|
}
|
|
18124
|
-
|
|
18125
|
-
|
|
18126
|
-
|
|
18246
|
+
};
|
|
18247
|
+
const _runStroke = () => {
|
|
18248
|
+
if (doFillOrStroke.doStroke) {
|
|
18249
|
+
if (strokeCb) {
|
|
18250
|
+
strokeCb(context, group.attribute, groupAttribute);
|
|
18251
|
+
}
|
|
18252
|
+
else if (sVisible) {
|
|
18253
|
+
context.setStrokeStyle(group, group.attribute, x, y, groupAttribute);
|
|
18254
|
+
context.stroke();
|
|
18255
|
+
}
|
|
18127
18256
|
}
|
|
18257
|
+
};
|
|
18258
|
+
if (!fillStrokeOrder) {
|
|
18259
|
+
_runFill();
|
|
18260
|
+
_runStroke();
|
|
18128
18261
|
}
|
|
18129
|
-
|
|
18130
|
-
|
|
18131
|
-
|
|
18132
|
-
}
|
|
18133
|
-
else if (sVisible) {
|
|
18134
|
-
context.setStrokeStyle(group, group.attribute, x, y, groupAttribute);
|
|
18135
|
-
context.stroke();
|
|
18136
|
-
}
|
|
18262
|
+
else {
|
|
18263
|
+
_runStroke();
|
|
18264
|
+
_runFill();
|
|
18137
18265
|
}
|
|
18138
18266
|
this._groupRenderContribitions.forEach(c => {
|
|
18139
18267
|
if (c.time === BaseRenderContributionTime.afterFillStroke) {
|
|
@@ -18233,7 +18361,7 @@ let DefaultCanvasImageRender = class DefaultCanvasImageRender extends BaseRender
|
|
|
18233
18361
|
}
|
|
18234
18362
|
drawShape(image, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
18235
18363
|
const imageAttribute = getTheme(image).image;
|
|
18236
|
-
const { width = imageAttribute.width, height = imageAttribute.height, repeatX = imageAttribute.repeatX, repeatY = imageAttribute.repeatY, x: originX = imageAttribute.x, y: originY = imageAttribute.y, cornerRadius = imageAttribute.cornerRadius, image: url } = image.attribute;
|
|
18364
|
+
const { width = imageAttribute.width, height = imageAttribute.height, repeatX = imageAttribute.repeatX, repeatY = imageAttribute.repeatY, x: originX = imageAttribute.x, y: originY = imageAttribute.y, cornerRadius = imageAttribute.cornerRadius, fillStrokeOrder = imageAttribute.fillStrokeOrder, image: url } = image.attribute;
|
|
18237
18365
|
const data = this.valid(image, imageAttribute, fillCb);
|
|
18238
18366
|
if (!data) {
|
|
18239
18367
|
return;
|
|
@@ -18241,58 +18369,70 @@ let DefaultCanvasImageRender = class DefaultCanvasImageRender extends BaseRender
|
|
|
18241
18369
|
const { fVisible, sVisible, doFill, doStroke } = data;
|
|
18242
18370
|
context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute);
|
|
18243
18371
|
this.beforeRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);
|
|
18244
|
-
|
|
18245
|
-
if (
|
|
18246
|
-
fillCb
|
|
18247
|
-
|
|
18248
|
-
else if (fVisible) {
|
|
18249
|
-
if (!url || !image.resources) {
|
|
18250
|
-
return;
|
|
18251
|
-
}
|
|
18252
|
-
const res = image.resources.get(url);
|
|
18253
|
-
if (res.state !== 'success') {
|
|
18254
|
-
return;
|
|
18372
|
+
const _runFill = () => {
|
|
18373
|
+
if (doFill) {
|
|
18374
|
+
if (fillCb) {
|
|
18375
|
+
fillCb(context, image.attribute, imageAttribute);
|
|
18255
18376
|
}
|
|
18256
|
-
|
|
18257
|
-
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18377
|
+
else if (fVisible) {
|
|
18378
|
+
if (!url || !image.resources) {
|
|
18379
|
+
return;
|
|
18380
|
+
}
|
|
18381
|
+
const res = image.resources.get(url);
|
|
18382
|
+
if (res.state !== 'success') {
|
|
18383
|
+
return;
|
|
18384
|
+
}
|
|
18385
|
+
let needRestore = false;
|
|
18386
|
+
if (cornerRadius === 0 || (isArray(cornerRadius) && cornerRadius.every(num => num === 0))) ;
|
|
18387
|
+
else {
|
|
18388
|
+
context.beginPath();
|
|
18389
|
+
createRectPath(context, x, y, width, height, cornerRadius);
|
|
18390
|
+
context.save();
|
|
18391
|
+
context.clip();
|
|
18392
|
+
needRestore = true;
|
|
18393
|
+
}
|
|
18394
|
+
context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
|
|
18395
|
+
let repeat = 0;
|
|
18396
|
+
if (repeatX === 'repeat') {
|
|
18397
|
+
repeat |= 0b0001;
|
|
18398
|
+
}
|
|
18399
|
+
if (repeatY === 'repeat') {
|
|
18400
|
+
repeat |= 0b0010;
|
|
18401
|
+
}
|
|
18402
|
+
if (repeat) {
|
|
18403
|
+
const pattern = context.createPattern(res.data, repeatStr[repeat]);
|
|
18404
|
+
context.fillStyle = pattern;
|
|
18405
|
+
context.translate(x, y, true);
|
|
18406
|
+
context.fillRect(0, 0, width, height);
|
|
18407
|
+
context.translate(-x, -y, true);
|
|
18408
|
+
}
|
|
18409
|
+
else {
|
|
18410
|
+
context.drawImage(res.data, x, y, width, height);
|
|
18411
|
+
}
|
|
18412
|
+
if (needRestore) {
|
|
18413
|
+
context.restore();
|
|
18414
|
+
}
|
|
18279
18415
|
}
|
|
18280
|
-
|
|
18281
|
-
|
|
18416
|
+
}
|
|
18417
|
+
};
|
|
18418
|
+
const _runStroke = () => {
|
|
18419
|
+
if (doStroke) {
|
|
18420
|
+
if (strokeCb) {
|
|
18421
|
+
strokeCb(context, image.attribute, imageAttribute);
|
|
18282
18422
|
}
|
|
18283
|
-
if (
|
|
18284
|
-
context.
|
|
18423
|
+
else if (sVisible) {
|
|
18424
|
+
context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute);
|
|
18425
|
+
context.stroke();
|
|
18285
18426
|
}
|
|
18286
18427
|
}
|
|
18428
|
+
};
|
|
18429
|
+
if (!fillStrokeOrder) {
|
|
18430
|
+
_runFill();
|
|
18431
|
+
_runStroke();
|
|
18287
18432
|
}
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
}
|
|
18292
|
-
else if (sVisible) {
|
|
18293
|
-
context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute);
|
|
18294
|
-
context.stroke();
|
|
18295
|
-
}
|
|
18433
|
+
else {
|
|
18434
|
+
_runStroke();
|
|
18435
|
+
_runFill();
|
|
18296
18436
|
}
|
|
18297
18437
|
this.afterRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);
|
|
18298
18438
|
}
|