@visactor/vrender-core 0.21.0-alpha.2 → 0.21.0-alpha.4
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/common/simplify.js +2 -3
- package/cjs/common/simplify.js.map +1 -1
- package/cjs/core/contributions/textMeasure/AtextMeasure.js +13 -5
- package/cjs/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/cjs/core/stage.d.ts +3 -0
- package/cjs/core/stage.js +11 -2
- package/cjs/core/stage.js.map +1 -1
- package/cjs/core/window.js +3 -2
- package/cjs/core/window.js.map +1 -1
- package/cjs/event/event-manager.d.ts +1 -0
- package/cjs/event/event-manager.js +1 -1
- package/cjs/event/event-manager.js.map +1 -1
- package/cjs/event/event-system.js +2 -1
- package/cjs/event/event-system.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/interface/stage.d.ts +1 -0
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/plugins/builtin-plugin/auto-refresh-plugin.d.ts +16 -0
- package/cjs/plugins/builtin-plugin/auto-refresh-plugin.js +48 -0
- package/cjs/plugins/builtin-plugin/auto-refresh-plugin.js.map +1 -0
- 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/contributions/image-contribution-render.d.ts +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js +3 -2
- package/cjs/render/contributions/render/contributions/image-contribution-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 +31 -25
- 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/cjs/resource-loader/loader.js +1 -1
- package/cjs/resource-loader/loader.js.map +1 -1
- package/dist/index.es.js +499 -314
- package/es/common/path-svg.js +3 -3
- package/es/common/path-svg.js.map +1 -1
- package/es/common/simplify.js +2 -3
- package/es/common/simplify.js.map +1 -1
- package/es/core/contributions/textMeasure/AtextMeasure.js +14 -4
- package/es/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
- package/es/core/stage.d.ts +3 -0
- package/es/core/stage.js +12 -1
- package/es/core/stage.js.map +1 -1
- package/es/core/window.js +3 -1
- package/es/core/window.js.map +1 -1
- package/es/event/event-manager.d.ts +1 -0
- package/es/event/event-manager.js +1 -1
- package/es/event/event-manager.js.map +1 -1
- package/es/event/event-system.js +2 -1
- package/es/event/event-system.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/interface/stage.d.ts +1 -0
- package/es/interface/stage.js.map +1 -1
- package/es/plugins/builtin-plugin/auto-refresh-plugin.d.ts +16 -0
- package/es/plugins/builtin-plugin/auto-refresh-plugin.js +41 -0
- package/es/plugins/builtin-plugin/auto-refresh-plugin.js.map +1 -0
- 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/contributions/image-contribution-render.d.ts +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.js +3 -2
- package/es/render/contributions/render/contributions/image-contribution-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 +31 -25
- 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/es/resource-loader/loader.js +1 -1
- package/es/resource-loader/loader.js.map +1 -1
- package/package.json +1 -1
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 });
|
|
@@ -3376,6 +3383,11 @@ let ATextMeasure = class ATextMeasure {
|
|
|
3376
3383
|
return data;
|
|
3377
3384
|
}
|
|
3378
3385
|
_clipTextEnd(text, options, width, leftIdx, rightIdx) {
|
|
3386
|
+
if (leftIdx === rightIdx) {
|
|
3387
|
+
Logger.getInstance().warn(`【_clipTextEnd】不应该走到这里${text}, ${leftIdx}, ${rightIdx}`);
|
|
3388
|
+
const subText = text.substring(0, rightIdx + 1);
|
|
3389
|
+
return { str: subText, width: this.measureTextWidth(subText, options) };
|
|
3390
|
+
}
|
|
3379
3391
|
const middleIdx = Math.floor((leftIdx + rightIdx) / 2);
|
|
3380
3392
|
const subText = text.substring(0, middleIdx + 1);
|
|
3381
3393
|
const strWidth = this.measureTextWidth(subText, options);
|
|
@@ -3406,25 +3418,25 @@ let ATextMeasure = class ATextMeasure {
|
|
|
3406
3418
|
}
|
|
3407
3419
|
_clipTextStart(text, options, width, leftIdx, rightIdx) {
|
|
3408
3420
|
const middleIdx = Math.ceil((leftIdx + rightIdx) / 2);
|
|
3409
|
-
const subText = text.substring(middleIdx - 1, text.length
|
|
3421
|
+
const subText = text.substring(middleIdx - 1, text.length);
|
|
3410
3422
|
const strWidth = this.measureTextWidth(subText, options);
|
|
3411
3423
|
let length;
|
|
3412
3424
|
if (strWidth > width) {
|
|
3413
3425
|
if (subText.length <= 1) {
|
|
3414
3426
|
return { str: '', width: 0 };
|
|
3415
3427
|
}
|
|
3416
|
-
const str = text.substring(middleIdx, text.length
|
|
3428
|
+
const str = text.substring(middleIdx, text.length);
|
|
3417
3429
|
length = this.measureTextWidth(str, options);
|
|
3418
3430
|
if (length <= width) {
|
|
3419
3431
|
return { str, width: length };
|
|
3420
3432
|
}
|
|
3421
|
-
return this._clipTextStart(text, options, width, middleIdx, text.length
|
|
3433
|
+
return this._clipTextStart(text, options, width, middleIdx, text.length);
|
|
3422
3434
|
}
|
|
3423
3435
|
else if (strWidth < width) {
|
|
3424
3436
|
if (middleIdx <= 0) {
|
|
3425
3437
|
return { str: text, width: this.measureTextWidth(text, options) };
|
|
3426
3438
|
}
|
|
3427
|
-
const str = text.substring(middleIdx - 2, text.length
|
|
3439
|
+
const str = text.substring(middleIdx - 2, text.length);
|
|
3428
3440
|
length = this.measureTextWidth(str, options);
|
|
3429
3441
|
if (length >= width) {
|
|
3430
3442
|
return { str: subText, width: strWidth };
|
|
@@ -4446,8 +4458,8 @@ let DefaultWindow = class DefaultWindow {
|
|
|
4446
4458
|
const viewBox = this._handler.getViewBox();
|
|
4447
4459
|
return !(viewBox.x1 === 0 &&
|
|
4448
4460
|
viewBox.y1 === 0 &&
|
|
4449
|
-
this.width
|
|
4450
|
-
this.height
|
|
4461
|
+
isNumberClose(this.width, viewBox.width()) &&
|
|
4462
|
+
isNumberClose(this.height, viewBox.height()));
|
|
4451
4463
|
}
|
|
4452
4464
|
isVisible(bbox) {
|
|
4453
4465
|
return this._handler.isVisible(bbox);
|
|
@@ -5944,7 +5956,7 @@ class EventManager {
|
|
|
5944
5956
|
this.dispatchEvent(clickEvent, 'dblclick');
|
|
5945
5957
|
}
|
|
5946
5958
|
}
|
|
5947
|
-
else if (clickEvent.pointerType === 'touch') {
|
|
5959
|
+
else if (clickEvent.pointerType === 'touch' && this._config.supportsTouchEvents) {
|
|
5948
5960
|
this.dispatchEvent(clickEvent, 'tap');
|
|
5949
5961
|
if (clickHistory.clickCount === 2) {
|
|
5950
5962
|
this.dispatchEvent(clickEvent, 'dbltap');
|
|
@@ -6403,7 +6415,8 @@ class EventSystem {
|
|
|
6403
6415
|
};
|
|
6404
6416
|
const { targetElement, resolution, rootNode, global, autoPreventDefault = false, clickInterval, supportsTouchEvents = global.supportsTouchEvents, supportsPointerEvents = global.supportsPointerEvents } = params;
|
|
6405
6417
|
this.manager = new EventManager(rootNode, {
|
|
6406
|
-
clickInterval
|
|
6418
|
+
clickInterval,
|
|
6419
|
+
supportsTouchEvents: supportsTouchEvents
|
|
6407
6420
|
});
|
|
6408
6421
|
this.globalObj = global;
|
|
6409
6422
|
this.supportsPointerEvents = supportsPointerEvents;
|
|
@@ -10797,10 +10810,10 @@ class ResourceLoader {
|
|
|
10797
10810
|
static GetFile(url, type) {
|
|
10798
10811
|
let data = ResourceLoader.cache.get(url);
|
|
10799
10812
|
if (data) {
|
|
10800
|
-
if (data.loadState === '
|
|
10813
|
+
if (data.loadState === 'fail') {
|
|
10801
10814
|
return Promise.reject();
|
|
10802
10815
|
}
|
|
10803
|
-
else if (data.loadState === 'loading') {
|
|
10816
|
+
else if (data.loadState === 'init' || data.loadState === 'loading') {
|
|
10804
10817
|
return data.dataPromise.then(data => data.data);
|
|
10805
10818
|
}
|
|
10806
10819
|
return Promise.resolve(data.data);
|
|
@@ -15861,8 +15874,13 @@ class DefaultImageRenderContribution extends DefaultRectRenderContribution {
|
|
|
15861
15874
|
this.useStyle = true;
|
|
15862
15875
|
this.order = 0;
|
|
15863
15876
|
}
|
|
15864
|
-
drawShape(
|
|
15865
|
-
|
|
15877
|
+
drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
|
|
15878
|
+
if (image.isGifImage && image.renderFrame && image.playing) {
|
|
15879
|
+
image.renderFrame(context, x, y);
|
|
15880
|
+
}
|
|
15881
|
+
else {
|
|
15882
|
+
return super.drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
15883
|
+
}
|
|
15866
15884
|
}
|
|
15867
15885
|
}
|
|
15868
15886
|
const defaultImageRenderContribution = new DefaultImageRenderContribution();
|
|
@@ -16010,7 +16028,7 @@ let DefaultCanvasArcRender = class DefaultCanvasArcRender extends BaseRender {
|
|
|
16010
16028
|
}
|
|
16011
16029
|
drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
16012
16030
|
const arcAttribute = getTheme(arc, params === null || params === void 0 ? void 0 : params.theme).arc;
|
|
16013
|
-
const { fill = arcAttribute.fill, stroke = arcAttribute.stroke, x: originX = arcAttribute.x, y: originY = arcAttribute.y } = arc.attribute;
|
|
16031
|
+
const { fill = arcAttribute.fill, stroke = arcAttribute.stroke, x: originX = arcAttribute.x, y: originY = arcAttribute.y, fillStrokeOrder = arcAttribute.fillStrokeOrder } = arc.attribute;
|
|
16014
16032
|
const data = this.valid(arc, arcAttribute, fillCb, strokeCb);
|
|
16015
16033
|
if (!data) {
|
|
16016
16034
|
return;
|
|
@@ -16038,23 +16056,35 @@ let DefaultCanvasArcRender = class DefaultCanvasArcRender extends BaseRender {
|
|
|
16038
16056
|
beforeRenderContribitionsRuned = true;
|
|
16039
16057
|
context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute);
|
|
16040
16058
|
this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
|
|
16041
|
-
|
|
16042
|
-
if (
|
|
16043
|
-
fillCb
|
|
16059
|
+
const _runFill = () => {
|
|
16060
|
+
if (doFill) {
|
|
16061
|
+
if (fillCb) {
|
|
16062
|
+
fillCb(context, arc.attribute, arcAttribute);
|
|
16063
|
+
}
|
|
16064
|
+
else if (fVisible) {
|
|
16065
|
+
context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute);
|
|
16066
|
+
context.fill();
|
|
16067
|
+
}
|
|
16044
16068
|
}
|
|
16045
|
-
|
|
16046
|
-
|
|
16047
|
-
|
|
16069
|
+
};
|
|
16070
|
+
const _runStroke = () => {
|
|
16071
|
+
if (doStroke && isFullStroke) {
|
|
16072
|
+
if (strokeCb) {
|
|
16073
|
+
strokeCb(context, arc.attribute, arcAttribute);
|
|
16074
|
+
}
|
|
16075
|
+
else if (sVisible) {
|
|
16076
|
+
context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute);
|
|
16077
|
+
context.stroke();
|
|
16078
|
+
}
|
|
16048
16079
|
}
|
|
16080
|
+
};
|
|
16081
|
+
if (!fillStrokeOrder) {
|
|
16082
|
+
_runFill();
|
|
16083
|
+
_runStroke();
|
|
16049
16084
|
}
|
|
16050
|
-
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
}
|
|
16054
|
-
else if (sVisible) {
|
|
16055
|
-
context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute);
|
|
16056
|
-
context.stroke();
|
|
16057
|
-
}
|
|
16085
|
+
else {
|
|
16086
|
+
_runStroke();
|
|
16087
|
+
_runFill();
|
|
16058
16088
|
}
|
|
16059
16089
|
}
|
|
16060
16090
|
if (!isFullStroke && doStroke) {
|
|
@@ -16084,24 +16114,36 @@ let DefaultCanvasArcRender = class DefaultCanvasArcRender extends BaseRender {
|
|
|
16084
16114
|
if (!beforeRenderContribitionsRuned) {
|
|
16085
16115
|
this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
|
|
16086
16116
|
}
|
|
16087
|
-
|
|
16088
|
-
|
|
16089
|
-
|
|
16090
|
-
|
|
16091
|
-
|
|
16092
|
-
|
|
16093
|
-
|
|
16094
|
-
|
|
16095
|
-
|
|
16117
|
+
const _runFill = () => {
|
|
16118
|
+
if (doFill) {
|
|
16119
|
+
const color = fill;
|
|
16120
|
+
if (color.gradient === 'conical') {
|
|
16121
|
+
const lastColor = getConicGradientAt(0, 0, endAngle, color);
|
|
16122
|
+
if (fillCb) ;
|
|
16123
|
+
else if (fillVisible) {
|
|
16124
|
+
context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute);
|
|
16125
|
+
context.fillStyle = lastColor;
|
|
16126
|
+
context.fill();
|
|
16127
|
+
}
|
|
16096
16128
|
}
|
|
16097
16129
|
}
|
|
16098
|
-
}
|
|
16099
|
-
|
|
16100
|
-
if (
|
|
16101
|
-
|
|
16102
|
-
|
|
16103
|
-
|
|
16130
|
+
};
|
|
16131
|
+
const _runStroke = () => {
|
|
16132
|
+
if (doStroke) {
|
|
16133
|
+
if (strokeCb) ;
|
|
16134
|
+
else if (sVisible) {
|
|
16135
|
+
context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute);
|
|
16136
|
+
context.stroke();
|
|
16137
|
+
}
|
|
16104
16138
|
}
|
|
16139
|
+
};
|
|
16140
|
+
if (!fillStrokeOrder) {
|
|
16141
|
+
_runFill();
|
|
16142
|
+
_runStroke();
|
|
16143
|
+
}
|
|
16144
|
+
else {
|
|
16145
|
+
_runFill();
|
|
16146
|
+
_runStroke();
|
|
16105
16147
|
}
|
|
16106
16148
|
}
|
|
16107
16149
|
}
|
|
@@ -16137,7 +16179,7 @@ let DefaultCanvasCircleRender = class DefaultCanvasCircleRender extends BaseRend
|
|
|
16137
16179
|
}
|
|
16138
16180
|
drawShape(circle, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
16139
16181
|
const circleAttribute = getTheme(circle, params === null || params === void 0 ? void 0 : params.theme).circle;
|
|
16140
|
-
const { radius = circleAttribute.radius, startAngle = circleAttribute.startAngle, endAngle = circleAttribute.endAngle, x: originX = circleAttribute.x, y: originY = circleAttribute.y } = circle.attribute;
|
|
16182
|
+
const { radius = circleAttribute.radius, startAngle = circleAttribute.startAngle, endAngle = circleAttribute.endAngle, x: originX = circleAttribute.x, y: originY = circleAttribute.y, fillStrokeOrder = circleAttribute.fillStrokeOrder } = circle.attribute;
|
|
16141
16183
|
const data = this.valid(circle, circleAttribute, fillCb, strokeCb);
|
|
16142
16184
|
if (!data) {
|
|
16143
16185
|
return;
|
|
@@ -16148,23 +16190,35 @@ let DefaultCanvasCircleRender = class DefaultCanvasCircleRender extends BaseRend
|
|
|
16148
16190
|
context.closePath();
|
|
16149
16191
|
context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute);
|
|
16150
16192
|
this.beforeRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
|
|
16151
|
-
|
|
16152
|
-
if (
|
|
16153
|
-
fillCb
|
|
16193
|
+
const _runFill = () => {
|
|
16194
|
+
if (doFill) {
|
|
16195
|
+
if (fillCb) {
|
|
16196
|
+
fillCb(context, circle.attribute, circleAttribute);
|
|
16197
|
+
}
|
|
16198
|
+
else if (fVisible) {
|
|
16199
|
+
context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute);
|
|
16200
|
+
context.fill();
|
|
16201
|
+
}
|
|
16154
16202
|
}
|
|
16155
|
-
|
|
16156
|
-
|
|
16157
|
-
|
|
16203
|
+
};
|
|
16204
|
+
const _runStroke = () => {
|
|
16205
|
+
if (doStroke) {
|
|
16206
|
+
if (strokeCb) {
|
|
16207
|
+
strokeCb(context, circle.attribute, circleAttribute);
|
|
16208
|
+
}
|
|
16209
|
+
else if (sVisible) {
|
|
16210
|
+
context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute);
|
|
16211
|
+
context.stroke();
|
|
16212
|
+
}
|
|
16158
16213
|
}
|
|
16214
|
+
};
|
|
16215
|
+
if (!fillStrokeOrder) {
|
|
16216
|
+
_runFill();
|
|
16217
|
+
_runStroke();
|
|
16159
16218
|
}
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
}
|
|
16164
|
-
else if (sVisible) {
|
|
16165
|
-
context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute);
|
|
16166
|
-
context.stroke();
|
|
16167
|
-
}
|
|
16219
|
+
else {
|
|
16220
|
+
_runStroke();
|
|
16221
|
+
_runFill();
|
|
16168
16222
|
}
|
|
16169
16223
|
this.afterRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
|
|
16170
16224
|
}
|
|
@@ -16922,7 +16976,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
16922
16976
|
this.init(areaRenderContribitions);
|
|
16923
16977
|
}
|
|
16924
16978
|
drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
|
|
16925
|
-
var _a, _b, _c
|
|
16979
|
+
var _a, _b, _c;
|
|
16926
16980
|
const { points } = area.attribute;
|
|
16927
16981
|
if (points.length < 2) {
|
|
16928
16982
|
return;
|
|
@@ -16943,44 +16997,51 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
16943
16997
|
context.setShadowBlendStyle && context.setShadowBlendStyle(area, area.attribute, areaAttribute);
|
|
16944
16998
|
this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, false, fill, false, areaAttribute, drawContext, fillCb, null, { attribute: area.attribute });
|
|
16945
16999
|
const { x: originX = 0, x: originY = 0 } = area.attribute;
|
|
16946
|
-
|
|
16947
|
-
if (
|
|
16948
|
-
fillCb
|
|
16949
|
-
|
|
16950
|
-
|
|
16951
|
-
|
|
16952
|
-
|
|
17000
|
+
const _runFill = () => {
|
|
17001
|
+
if (fill !== false) {
|
|
17002
|
+
if (fillCb) {
|
|
17003
|
+
fillCb(context, area.attribute, areaAttribute);
|
|
17004
|
+
}
|
|
17005
|
+
else if (fillOpacity) {
|
|
17006
|
+
context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute);
|
|
17007
|
+
context.fill();
|
|
17008
|
+
}
|
|
16953
17009
|
}
|
|
16954
|
-
}
|
|
16955
|
-
|
|
16956
|
-
|
|
16957
|
-
|
|
16958
|
-
|
|
16959
|
-
|
|
16960
|
-
|
|
16961
|
-
|
|
16962
|
-
|
|
16963
|
-
|
|
16964
|
-
|
|
17010
|
+
};
|
|
17011
|
+
const _runStroke = () => {
|
|
17012
|
+
var _a, _b;
|
|
17013
|
+
if (stroke) {
|
|
17014
|
+
const { stroke = areaAttribute && areaAttribute.stroke } = area.attribute;
|
|
17015
|
+
if (isArray(stroke) && (stroke[0] || stroke[2]) && stroke[1] === false) {
|
|
17016
|
+
context.beginPath();
|
|
17017
|
+
if (stroke[0]) {
|
|
17018
|
+
context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
|
|
17019
|
+
for (let i = 1; i < points.length; i++) {
|
|
17020
|
+
const p = points[i];
|
|
17021
|
+
context.lineTo(p.x + offsetX, p.y + offsetY, z);
|
|
17022
|
+
}
|
|
16965
17023
|
}
|
|
16966
|
-
|
|
16967
|
-
|
|
16968
|
-
|
|
16969
|
-
|
|
16970
|
-
|
|
16971
|
-
|
|
16972
|
-
|
|
17024
|
+
else if (stroke[2]) {
|
|
17025
|
+
const endP = points[points.length - 1];
|
|
17026
|
+
context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
|
|
17027
|
+
for (let i = points.length - 2; i >= 0; i--) {
|
|
17028
|
+
const p = points[i];
|
|
17029
|
+
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);
|
|
17030
|
+
}
|
|
16973
17031
|
}
|
|
16974
17032
|
}
|
|
17033
|
+
if (strokeCb) {
|
|
17034
|
+
strokeCb(context, area.attribute, areaAttribute);
|
|
17035
|
+
}
|
|
17036
|
+
else {
|
|
17037
|
+
context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute);
|
|
17038
|
+
context.stroke();
|
|
17039
|
+
}
|
|
16975
17040
|
}
|
|
16976
|
-
|
|
16977
|
-
|
|
16978
|
-
|
|
16979
|
-
|
|
16980
|
-
context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute);
|
|
16981
|
-
context.stroke();
|
|
16982
|
-
}
|
|
16983
|
-
}
|
|
17041
|
+
};
|
|
17042
|
+
_runFill();
|
|
17043
|
+
this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, false, fill, false, areaAttribute, drawContext, fillCb, null, { attribute: area.attribute });
|
|
17044
|
+
_runStroke();
|
|
16984
17045
|
}
|
|
16985
17046
|
drawShape(area, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
16986
17047
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -17210,38 +17271,44 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
17210
17271
|
this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, false, fill, false, defaultAttribute, drawContext, fillCb, null, { attribute });
|
|
17211
17272
|
context.setShadowBlendStyle && context.setShadowBlendStyle(area, attribute, defaultAttribute);
|
|
17212
17273
|
const { x: originX = 0, x: originY = 0 } = attribute;
|
|
17213
|
-
|
|
17214
|
-
if (
|
|
17215
|
-
fillCb
|
|
17216
|
-
|
|
17217
|
-
|
|
17218
|
-
|
|
17219
|
-
|
|
17220
|
-
|
|
17221
|
-
|
|
17222
|
-
this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, false, fill, false, defaultAttribute, drawContext, fillCb, null, { attribute });
|
|
17223
|
-
if (stroke !== false) {
|
|
17224
|
-
if (strokeCb) {
|
|
17225
|
-
strokeCb(context, attribute, defaultAttribute);
|
|
17274
|
+
const _runFill = () => {
|
|
17275
|
+
if (fill !== false) {
|
|
17276
|
+
if (fillCb) {
|
|
17277
|
+
fillCb(context, attribute, defaultAttribute);
|
|
17278
|
+
}
|
|
17279
|
+
else if (fillOpacity) {
|
|
17280
|
+
context.setCommonStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute);
|
|
17281
|
+
context.fill();
|
|
17282
|
+
}
|
|
17226
17283
|
}
|
|
17227
|
-
|
|
17228
|
-
|
|
17229
|
-
|
|
17230
|
-
|
|
17231
|
-
|
|
17232
|
-
|
|
17233
|
-
|
|
17234
|
-
|
|
17235
|
-
|
|
17236
|
-
|
|
17237
|
-
|
|
17238
|
-
|
|
17239
|
-
|
|
17284
|
+
};
|
|
17285
|
+
const _runStroke = () => {
|
|
17286
|
+
if (stroke !== false) {
|
|
17287
|
+
if (strokeCb) {
|
|
17288
|
+
strokeCb(context, attribute, defaultAttribute);
|
|
17289
|
+
}
|
|
17290
|
+
else {
|
|
17291
|
+
const { stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke } = attribute;
|
|
17292
|
+
if (isArray(stroke) && (stroke[0] || stroke[2]) && stroke[1] === false) {
|
|
17293
|
+
context.beginPath();
|
|
17294
|
+
drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction$1.ROW ? 'x' : 'y', {
|
|
17295
|
+
offsetX,
|
|
17296
|
+
offsetY,
|
|
17297
|
+
offsetZ,
|
|
17298
|
+
drawConnect: connect,
|
|
17299
|
+
mode: connectedType,
|
|
17300
|
+
zeroX: connectedX,
|
|
17301
|
+
zeroY: connectedY
|
|
17302
|
+
});
|
|
17303
|
+
}
|
|
17304
|
+
context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute);
|
|
17305
|
+
context.stroke();
|
|
17240
17306
|
}
|
|
17241
|
-
context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute);
|
|
17242
|
-
context.stroke();
|
|
17243
17307
|
}
|
|
17244
|
-
}
|
|
17308
|
+
};
|
|
17309
|
+
_runFill();
|
|
17310
|
+
this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, false, fill, false, defaultAttribute, drawContext, fillCb, null, { attribute });
|
|
17311
|
+
_runStroke();
|
|
17245
17312
|
return ret;
|
|
17246
17313
|
}
|
|
17247
17314
|
};
|
|
@@ -17266,7 +17333,7 @@ let DefaultCanvasPathRender = class DefaultCanvasPathRender extends BaseRender {
|
|
|
17266
17333
|
drawShape(path, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17267
17334
|
var _a, _b, _c;
|
|
17268
17335
|
const pathAttribute = (_a = this.tempTheme) !== null && _a !== void 0 ? _a : getTheme(path, params === null || params === void 0 ? void 0 : params.theme).path;
|
|
17269
|
-
const { x: originX = pathAttribute.x, y: originY = pathAttribute.y } = path.attribute;
|
|
17336
|
+
const { x: originX = pathAttribute.x, y: originY = pathAttribute.y, fillStrokeOrder = pathAttribute.fillStrokeOrder } = path.attribute;
|
|
17270
17337
|
const z = (_b = this.z) !== null && _b !== void 0 ? _b : 0;
|
|
17271
17338
|
const data = this.valid(path, pathAttribute, fillCb, strokeCb);
|
|
17272
17339
|
if (!data) {
|
|
@@ -17283,23 +17350,35 @@ let DefaultCanvasPathRender = class DefaultCanvasPathRender extends BaseRender {
|
|
|
17283
17350
|
}
|
|
17284
17351
|
context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute);
|
|
17285
17352
|
this.beforeRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
|
|
17286
|
-
|
|
17287
|
-
if (
|
|
17288
|
-
strokeCb
|
|
17353
|
+
const _runStroke = () => {
|
|
17354
|
+
if (doStroke) {
|
|
17355
|
+
if (strokeCb) {
|
|
17356
|
+
strokeCb(context, path.attribute, pathAttribute);
|
|
17357
|
+
}
|
|
17358
|
+
else if (sVisible) {
|
|
17359
|
+
context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute);
|
|
17360
|
+
context.stroke();
|
|
17361
|
+
}
|
|
17289
17362
|
}
|
|
17290
|
-
|
|
17291
|
-
|
|
17292
|
-
|
|
17363
|
+
};
|
|
17364
|
+
const _runFill = () => {
|
|
17365
|
+
if (doFill) {
|
|
17366
|
+
if (fillCb) {
|
|
17367
|
+
fillCb(context, path.attribute, pathAttribute);
|
|
17368
|
+
}
|
|
17369
|
+
else if (fVisible) {
|
|
17370
|
+
context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute);
|
|
17371
|
+
context.fill();
|
|
17372
|
+
}
|
|
17293
17373
|
}
|
|
17374
|
+
};
|
|
17375
|
+
if (!fillStrokeOrder) {
|
|
17376
|
+
_runFill();
|
|
17377
|
+
_runStroke();
|
|
17294
17378
|
}
|
|
17295
|
-
|
|
17296
|
-
|
|
17297
|
-
|
|
17298
|
-
}
|
|
17299
|
-
else if (fVisible) {
|
|
17300
|
-
context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute);
|
|
17301
|
-
context.fill();
|
|
17302
|
-
}
|
|
17379
|
+
else {
|
|
17380
|
+
_runStroke();
|
|
17381
|
+
_runFill();
|
|
17303
17382
|
}
|
|
17304
17383
|
this.afterRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
|
|
17305
17384
|
}
|
|
@@ -17333,7 +17412,7 @@ let DefaultCanvasRectRender = class DefaultCanvasRectRender extends BaseRender {
|
|
|
17333
17412
|
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17334
17413
|
var _a;
|
|
17335
17414
|
const rectAttribute = (_a = this.tempTheme) !== null && _a !== void 0 ? _a : getTheme(rect, params === null || params === void 0 ? void 0 : params.theme).rect;
|
|
17336
|
-
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;
|
|
17415
|
+
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;
|
|
17337
17416
|
let { width, height } = rect.attribute;
|
|
17338
17417
|
width = (width !== null && width !== void 0 ? width : x1 - originX) || 0;
|
|
17339
17418
|
height = (height !== null && height !== void 0 ? height : y1 - originY) || 0;
|
|
@@ -17364,23 +17443,35 @@ let DefaultCanvasRectRender = class DefaultCanvasRectRender extends BaseRender {
|
|
|
17364
17443
|
};
|
|
17365
17444
|
context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);
|
|
17366
17445
|
this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
|
|
17367
|
-
|
|
17368
|
-
if (
|
|
17369
|
-
fillCb
|
|
17446
|
+
const _runFill = () => {
|
|
17447
|
+
if (doFillOrStroke.doFill) {
|
|
17448
|
+
if (fillCb) {
|
|
17449
|
+
fillCb(context, rect.attribute, rectAttribute);
|
|
17450
|
+
}
|
|
17451
|
+
else if (fVisible) {
|
|
17452
|
+
context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute);
|
|
17453
|
+
context.fill();
|
|
17454
|
+
}
|
|
17370
17455
|
}
|
|
17371
|
-
|
|
17372
|
-
|
|
17373
|
-
|
|
17456
|
+
};
|
|
17457
|
+
const _runStroke = () => {
|
|
17458
|
+
if (doFillOrStroke.doStroke) {
|
|
17459
|
+
if (strokeCb) {
|
|
17460
|
+
strokeCb(context, rect.attribute, rectAttribute);
|
|
17461
|
+
}
|
|
17462
|
+
else if (sVisible) {
|
|
17463
|
+
context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute);
|
|
17464
|
+
context.stroke();
|
|
17465
|
+
}
|
|
17374
17466
|
}
|
|
17467
|
+
};
|
|
17468
|
+
if (!fillStrokeOrder) {
|
|
17469
|
+
_runFill();
|
|
17470
|
+
_runStroke();
|
|
17375
17471
|
}
|
|
17376
|
-
|
|
17377
|
-
|
|
17378
|
-
|
|
17379
|
-
}
|
|
17380
|
-
else if (sVisible) {
|
|
17381
|
-
context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute);
|
|
17382
|
-
context.stroke();
|
|
17383
|
-
}
|
|
17472
|
+
else {
|
|
17473
|
+
_runStroke();
|
|
17474
|
+
_runFill();
|
|
17384
17475
|
}
|
|
17385
17476
|
this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
17386
17477
|
}
|
|
@@ -17413,7 +17504,7 @@ let DefaultCanvasSymbolRender = class DefaultCanvasSymbolRender extends BaseRend
|
|
|
17413
17504
|
drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17414
17505
|
var _a;
|
|
17415
17506
|
const symbolAttribute = getTheme(symbol, params === null || params === void 0 ? void 0 : params.theme).symbol;
|
|
17416
|
-
const { size = symbolAttribute.size, x: originX = symbolAttribute.x, y: originY = symbolAttribute.y, scaleX = symbolAttribute.scaleX, scaleY = symbolAttribute.scaleY } = symbol.attribute;
|
|
17507
|
+
const { size = symbolAttribute.size, x: originX = symbolAttribute.x, y: originY = symbolAttribute.y, scaleX = symbolAttribute.scaleX, scaleY = symbolAttribute.scaleY, fillStrokeOrder = symbolAttribute.fillStrokeOrder } = symbol.attribute;
|
|
17417
17508
|
const data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);
|
|
17418
17509
|
if (!data) {
|
|
17419
17510
|
return;
|
|
@@ -17436,23 +17527,35 @@ let DefaultCanvasSymbolRender = class DefaultCanvasSymbolRender extends BaseRend
|
|
|
17436
17527
|
obj.stroke = (_c = a.stroke) !== null && _c !== void 0 ? _c : symbol.attribute.stroke;
|
|
17437
17528
|
a = obj;
|
|
17438
17529
|
}
|
|
17439
|
-
|
|
17440
|
-
if (
|
|
17441
|
-
fillCb
|
|
17530
|
+
const _runFill = () => {
|
|
17531
|
+
if (a.fill) {
|
|
17532
|
+
if (fillCb) {
|
|
17533
|
+
fillCb(context, symbol.attribute, symbolAttribute);
|
|
17534
|
+
}
|
|
17535
|
+
else {
|
|
17536
|
+
context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute);
|
|
17537
|
+
context.fill();
|
|
17538
|
+
}
|
|
17442
17539
|
}
|
|
17443
|
-
|
|
17444
|
-
|
|
17445
|
-
|
|
17540
|
+
};
|
|
17541
|
+
const _runStroke = () => {
|
|
17542
|
+
if (a.stroke) {
|
|
17543
|
+
if (strokeCb) {
|
|
17544
|
+
strokeCb(context, symbol.attribute, symbolAttribute);
|
|
17545
|
+
}
|
|
17546
|
+
else {
|
|
17547
|
+
context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);
|
|
17548
|
+
context.stroke();
|
|
17549
|
+
}
|
|
17446
17550
|
}
|
|
17551
|
+
};
|
|
17552
|
+
if (!fillStrokeOrder) {
|
|
17553
|
+
_runFill();
|
|
17554
|
+
_runStroke();
|
|
17447
17555
|
}
|
|
17448
|
-
|
|
17449
|
-
|
|
17450
|
-
|
|
17451
|
-
}
|
|
17452
|
-
else {
|
|
17453
|
-
context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);
|
|
17454
|
-
context.stroke();
|
|
17455
|
-
}
|
|
17556
|
+
else {
|
|
17557
|
+
_runStroke();
|
|
17558
|
+
_runFill();
|
|
17456
17559
|
}
|
|
17457
17560
|
};
|
|
17458
17561
|
if (keepDirIn3d && context.camera && context.project) {
|
|
@@ -17471,23 +17574,35 @@ let DefaultCanvasSymbolRender = class DefaultCanvasSymbolRender extends BaseRend
|
|
|
17471
17574
|
}
|
|
17472
17575
|
context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute);
|
|
17473
17576
|
this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
|
|
17474
|
-
|
|
17475
|
-
if (
|
|
17476
|
-
fillCb
|
|
17577
|
+
const _runFill = () => {
|
|
17578
|
+
if (doFill && !parsedPath.isSvg) {
|
|
17579
|
+
if (fillCb) {
|
|
17580
|
+
fillCb(context, symbol.attribute, symbolAttribute);
|
|
17581
|
+
}
|
|
17582
|
+
else if (fVisible) {
|
|
17583
|
+
context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute);
|
|
17584
|
+
context.fill();
|
|
17585
|
+
}
|
|
17477
17586
|
}
|
|
17478
|
-
|
|
17479
|
-
|
|
17480
|
-
|
|
17587
|
+
};
|
|
17588
|
+
const _runStroke = () => {
|
|
17589
|
+
if (doStroke && !parsedPath.isSvg) {
|
|
17590
|
+
if (strokeCb) {
|
|
17591
|
+
strokeCb(context, symbol.attribute, symbolAttribute);
|
|
17592
|
+
}
|
|
17593
|
+
else if (sVisible) {
|
|
17594
|
+
context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);
|
|
17595
|
+
context.stroke();
|
|
17596
|
+
}
|
|
17481
17597
|
}
|
|
17598
|
+
};
|
|
17599
|
+
if (!fillStrokeOrder) {
|
|
17600
|
+
_runFill();
|
|
17601
|
+
_runStroke();
|
|
17482
17602
|
}
|
|
17483
|
-
|
|
17484
|
-
|
|
17485
|
-
|
|
17486
|
-
}
|
|
17487
|
-
else if (sVisible) {
|
|
17488
|
-
context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);
|
|
17489
|
-
context.stroke();
|
|
17490
|
-
}
|
|
17603
|
+
else {
|
|
17604
|
+
_runStroke();
|
|
17605
|
+
_runFill();
|
|
17491
17606
|
}
|
|
17492
17607
|
this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
|
|
17493
17608
|
}
|
|
@@ -18012,7 +18127,7 @@ let DefaultCanvasPolygonRender = class DefaultCanvasPolygonRender extends BaseRe
|
|
|
18012
18127
|
}
|
|
18013
18128
|
drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
18014
18129
|
const polygonAttribute = getTheme(polygon, params === null || params === void 0 ? void 0 : params.theme).polygon;
|
|
18015
|
-
const { points = polygonAttribute.points, cornerRadius = polygonAttribute.cornerRadius, x: originX = polygonAttribute.x, y: originY = polygonAttribute.y, closePath = polygonAttribute.closePath } = polygon.attribute;
|
|
18130
|
+
const { points = polygonAttribute.points, cornerRadius = polygonAttribute.cornerRadius, x: originX = polygonAttribute.x, y: originY = polygonAttribute.y, closePath = polygonAttribute.closePath, fillStrokeOrder = polygonAttribute.fillStrokeOrder } = polygon.attribute;
|
|
18016
18131
|
const data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);
|
|
18017
18132
|
if (!data) {
|
|
18018
18133
|
return;
|
|
@@ -18028,23 +18143,35 @@ let DefaultCanvasPolygonRender = class DefaultCanvasPolygonRender extends BaseRe
|
|
|
18028
18143
|
closePath && context.closePath();
|
|
18029
18144
|
context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute);
|
|
18030
18145
|
this.beforeRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
|
|
18031
|
-
|
|
18032
|
-
if (
|
|
18033
|
-
fillCb
|
|
18146
|
+
const _runFill = () => {
|
|
18147
|
+
if (doFill) {
|
|
18148
|
+
if (fillCb) {
|
|
18149
|
+
fillCb(context, polygon.attribute, polygonAttribute);
|
|
18150
|
+
}
|
|
18151
|
+
else if (fVisible) {
|
|
18152
|
+
context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);
|
|
18153
|
+
context.fill();
|
|
18154
|
+
}
|
|
18034
18155
|
}
|
|
18035
|
-
|
|
18036
|
-
|
|
18037
|
-
|
|
18156
|
+
};
|
|
18157
|
+
const _runStroke = () => {
|
|
18158
|
+
if (doStroke) {
|
|
18159
|
+
if (strokeCb) {
|
|
18160
|
+
strokeCb(context, polygon.attribute, polygonAttribute);
|
|
18161
|
+
}
|
|
18162
|
+
else if (sVisible) {
|
|
18163
|
+
context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);
|
|
18164
|
+
context.stroke();
|
|
18165
|
+
}
|
|
18038
18166
|
}
|
|
18167
|
+
};
|
|
18168
|
+
if (!fillStrokeOrder) {
|
|
18169
|
+
_runFill();
|
|
18170
|
+
_runStroke();
|
|
18039
18171
|
}
|
|
18040
|
-
|
|
18041
|
-
|
|
18042
|
-
|
|
18043
|
-
}
|
|
18044
|
-
else if (sVisible) {
|
|
18045
|
-
context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);
|
|
18046
|
-
context.stroke();
|
|
18047
|
-
}
|
|
18172
|
+
else {
|
|
18173
|
+
_runStroke();
|
|
18174
|
+
_runFill();
|
|
18048
18175
|
}
|
|
18049
18176
|
this.afterRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
|
|
18050
18177
|
}
|
|
@@ -18067,7 +18194,7 @@ let DefaultCanvasGroupRender = class DefaultCanvasGroupRender {
|
|
|
18067
18194
|
}
|
|
18068
18195
|
drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
18069
18196
|
const groupAttribute = getTheme(group, params === null || params === void 0 ? void 0 : params.theme).group;
|
|
18070
|
-
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;
|
|
18197
|
+
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, x: originX = groupAttribute.x, y: originY = groupAttribute.y } = group.attribute;
|
|
18071
18198
|
const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);
|
|
18072
18199
|
const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);
|
|
18073
18200
|
const doFill = runFill(fill, background);
|
|
@@ -18123,23 +18250,35 @@ let DefaultCanvasGroupRender = class DefaultCanvasGroupRender {
|
|
|
18123
18250
|
context.clip();
|
|
18124
18251
|
}
|
|
18125
18252
|
context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);
|
|
18126
|
-
|
|
18127
|
-
if (
|
|
18128
|
-
fillCb
|
|
18253
|
+
const _runFill = () => {
|
|
18254
|
+
if (doFillOrStroke.doFill) {
|
|
18255
|
+
if (fillCb) {
|
|
18256
|
+
fillCb(context, group.attribute, groupAttribute);
|
|
18257
|
+
}
|
|
18258
|
+
else if (fVisible) {
|
|
18259
|
+
context.setCommonStyle(group, group.attribute, originX - x, originY - y, groupAttribute);
|
|
18260
|
+
context.fill();
|
|
18261
|
+
}
|
|
18129
18262
|
}
|
|
18130
|
-
|
|
18131
|
-
|
|
18132
|
-
|
|
18263
|
+
};
|
|
18264
|
+
const _runStroke = () => {
|
|
18265
|
+
if (doFillOrStroke.doStroke) {
|
|
18266
|
+
if (strokeCb) {
|
|
18267
|
+
strokeCb(context, group.attribute, groupAttribute);
|
|
18268
|
+
}
|
|
18269
|
+
else if (sVisible) {
|
|
18270
|
+
context.setStrokeStyle(group, group.attribute, originX - x, originY - y, groupAttribute);
|
|
18271
|
+
context.stroke();
|
|
18272
|
+
}
|
|
18133
18273
|
}
|
|
18274
|
+
};
|
|
18275
|
+
if (!fillStrokeOrder) {
|
|
18276
|
+
_runFill();
|
|
18277
|
+
_runStroke();
|
|
18134
18278
|
}
|
|
18135
|
-
|
|
18136
|
-
|
|
18137
|
-
|
|
18138
|
-
}
|
|
18139
|
-
else if (sVisible) {
|
|
18140
|
-
context.setStrokeStyle(group, group.attribute, x, y, groupAttribute);
|
|
18141
|
-
context.stroke();
|
|
18142
|
-
}
|
|
18279
|
+
else {
|
|
18280
|
+
_runStroke();
|
|
18281
|
+
_runFill();
|
|
18143
18282
|
}
|
|
18144
18283
|
this._groupRenderContribitions.forEach(c => {
|
|
18145
18284
|
if (c.time === BaseRenderContributionTime.afterFillStroke) {
|
|
@@ -18239,7 +18378,7 @@ let DefaultCanvasImageRender = class DefaultCanvasImageRender extends BaseRender
|
|
|
18239
18378
|
}
|
|
18240
18379
|
drawShape(image, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
18241
18380
|
const imageAttribute = getTheme(image).image;
|
|
18242
|
-
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;
|
|
18381
|
+
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;
|
|
18243
18382
|
const data = this.valid(image, imageAttribute, fillCb);
|
|
18244
18383
|
if (!data) {
|
|
18245
18384
|
return;
|
|
@@ -18247,73 +18386,87 @@ let DefaultCanvasImageRender = class DefaultCanvasImageRender extends BaseRender
|
|
|
18247
18386
|
const { fVisible, sVisible, doFill, doStroke } = data;
|
|
18248
18387
|
context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute);
|
|
18249
18388
|
this.beforeRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);
|
|
18250
|
-
|
|
18251
|
-
if (
|
|
18252
|
-
fillCb
|
|
18253
|
-
|
|
18254
|
-
else if (fVisible) {
|
|
18255
|
-
if (!url || !image.resources) {
|
|
18256
|
-
return;
|
|
18257
|
-
}
|
|
18258
|
-
const res = image.resources.get(url);
|
|
18259
|
-
if (res.state !== 'success') {
|
|
18260
|
-
return;
|
|
18389
|
+
const _runFill = () => {
|
|
18390
|
+
if (doFill) {
|
|
18391
|
+
if (fillCb) {
|
|
18392
|
+
fillCb(context, image.attribute, imageAttribute);
|
|
18261
18393
|
}
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18282
|
-
|
|
18283
|
-
|
|
18284
|
-
|
|
18394
|
+
else if (fVisible) {
|
|
18395
|
+
if (!url || !image.resources) {
|
|
18396
|
+
return;
|
|
18397
|
+
}
|
|
18398
|
+
const res = image.resources.get(url);
|
|
18399
|
+
if (res.state !== 'success') {
|
|
18400
|
+
return;
|
|
18401
|
+
}
|
|
18402
|
+
let needRestore = false;
|
|
18403
|
+
if (cornerRadius === 0 || (isArray(cornerRadius) && cornerRadius.every(num => num === 0))) ;
|
|
18404
|
+
else {
|
|
18405
|
+
context.beginPath();
|
|
18406
|
+
createRectPath(context, x, y, width, height, cornerRadius);
|
|
18407
|
+
context.save();
|
|
18408
|
+
context.clip();
|
|
18409
|
+
needRestore = true;
|
|
18410
|
+
}
|
|
18411
|
+
context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
|
|
18412
|
+
let repeat = 0;
|
|
18413
|
+
if (repeatX === 'repeat') {
|
|
18414
|
+
repeat |= 0b0001;
|
|
18415
|
+
}
|
|
18416
|
+
if (repeatY === 'repeat') {
|
|
18417
|
+
repeat |= 0b0010;
|
|
18418
|
+
}
|
|
18419
|
+
if (repeat) {
|
|
18420
|
+
const pattern = context.createPattern(res.data, repeatStr[repeat]);
|
|
18421
|
+
context.fillStyle = pattern;
|
|
18422
|
+
context.translate(x, y, true);
|
|
18423
|
+
context.fillRect(0, 0, width, height);
|
|
18424
|
+
context.translate(-x, -y, true);
|
|
18425
|
+
}
|
|
18426
|
+
else {
|
|
18427
|
+
context.drawImage(res.data, x, y, width, height);
|
|
18428
|
+
}
|
|
18429
|
+
if (needRestore) {
|
|
18430
|
+
context.restore();
|
|
18431
|
+
}
|
|
18285
18432
|
}
|
|
18286
|
-
|
|
18287
|
-
|
|
18433
|
+
}
|
|
18434
|
+
};
|
|
18435
|
+
const _runStroke = () => {
|
|
18436
|
+
if (doStroke) {
|
|
18437
|
+
if (strokeCb) {
|
|
18438
|
+
strokeCb(context, image.attribute, imageAttribute);
|
|
18288
18439
|
}
|
|
18289
|
-
if (
|
|
18290
|
-
context.
|
|
18440
|
+
else if (sVisible) {
|
|
18441
|
+
context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute);
|
|
18442
|
+
context.stroke();
|
|
18291
18443
|
}
|
|
18292
18444
|
}
|
|
18445
|
+
};
|
|
18446
|
+
if (!fillStrokeOrder) {
|
|
18447
|
+
_runFill();
|
|
18448
|
+
_runStroke();
|
|
18293
18449
|
}
|
|
18294
|
-
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
}
|
|
18298
|
-
else if (sVisible) {
|
|
18299
|
-
context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute);
|
|
18300
|
-
context.stroke();
|
|
18301
|
-
}
|
|
18450
|
+
else {
|
|
18451
|
+
_runStroke();
|
|
18452
|
+
_runFill();
|
|
18302
18453
|
}
|
|
18303
18454
|
this.afterRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);
|
|
18304
18455
|
}
|
|
18305
18456
|
draw(image, renderService, drawContext) {
|
|
18306
18457
|
const { image: url } = image.attribute;
|
|
18307
|
-
if (!
|
|
18308
|
-
|
|
18309
|
-
|
|
18310
|
-
|
|
18311
|
-
|
|
18312
|
-
|
|
18313
|
-
|
|
18314
|
-
|
|
18315
|
-
|
|
18316
|
-
|
|
18458
|
+
if (!image.isGifImage) {
|
|
18459
|
+
if (!url || !image.resources) {
|
|
18460
|
+
return;
|
|
18461
|
+
}
|
|
18462
|
+
const res = image.resources.get(url);
|
|
18463
|
+
if (res.state === 'loading' && isString(url)) {
|
|
18464
|
+
ResourceLoader.improveImageLoading(url);
|
|
18465
|
+
return;
|
|
18466
|
+
}
|
|
18467
|
+
else if (res.state !== 'success') {
|
|
18468
|
+
return;
|
|
18469
|
+
}
|
|
18317
18470
|
}
|
|
18318
18471
|
const { context } = renderService.drawParams;
|
|
18319
18472
|
if (!context) {
|
|
@@ -24219,6 +24372,63 @@ class AutoRenderPlugin {
|
|
|
24219
24372
|
}
|
|
24220
24373
|
}
|
|
24221
24374
|
|
|
24375
|
+
class AutoRefreshPlugin {
|
|
24376
|
+
constructor() {
|
|
24377
|
+
this.name = 'AutoRefreshPlugin';
|
|
24378
|
+
this.activeEvent = 'onRegister';
|
|
24379
|
+
this._uid = Generator.GenAutoIncrementId();
|
|
24380
|
+
this.key = this.name + this._uid;
|
|
24381
|
+
this.handleChange = (graphic) => {
|
|
24382
|
+
if (graphic.glyphHost) {
|
|
24383
|
+
graphic = graphic.glyphHost;
|
|
24384
|
+
}
|
|
24385
|
+
if (graphic.stage === this.pluginService.stage && graphic.stage != null) {
|
|
24386
|
+
graphic.stage.renderNextFrame();
|
|
24387
|
+
}
|
|
24388
|
+
};
|
|
24389
|
+
}
|
|
24390
|
+
activate(context) {
|
|
24391
|
+
this.pluginService = context;
|
|
24392
|
+
this.dpr = application.global.devicePixelRatio;
|
|
24393
|
+
this.refresh();
|
|
24394
|
+
}
|
|
24395
|
+
refresh() {
|
|
24396
|
+
if (!this._refreshByMediaQuery()) {
|
|
24397
|
+
this._refreshByRaf();
|
|
24398
|
+
}
|
|
24399
|
+
}
|
|
24400
|
+
_refreshByRaf() {
|
|
24401
|
+
const raf = application.global.getRequestAnimationFrame();
|
|
24402
|
+
this.rafId = raf(() => {
|
|
24403
|
+
if (application.global.devicePixelRatio !== this.dpr) {
|
|
24404
|
+
this.dpr = application.global.devicePixelRatio;
|
|
24405
|
+
this.pluginService.stage.setDpr(this.dpr, true);
|
|
24406
|
+
}
|
|
24407
|
+
this.refresh();
|
|
24408
|
+
});
|
|
24409
|
+
}
|
|
24410
|
+
_refreshByMediaQuery() {
|
|
24411
|
+
try {
|
|
24412
|
+
const mqString = `(resolution: ${window.devicePixelRatio}dppx)`;
|
|
24413
|
+
const updatePixelRatio = () => {
|
|
24414
|
+
if (window.devicePixelRatio !== this.dpr) {
|
|
24415
|
+
this.dpr = window.devicePixelRatio;
|
|
24416
|
+
this.pluginService.stage.setDpr(this.dpr, true);
|
|
24417
|
+
}
|
|
24418
|
+
};
|
|
24419
|
+
matchMedia(mqString).addEventListener('change', updatePixelRatio);
|
|
24420
|
+
}
|
|
24421
|
+
catch (err) {
|
|
24422
|
+
return false;
|
|
24423
|
+
}
|
|
24424
|
+
return true;
|
|
24425
|
+
}
|
|
24426
|
+
deactivate(context) {
|
|
24427
|
+
const craf = application.global.getCancelAnimationFrame();
|
|
24428
|
+
craf && this.rafId && craf(this.rafId);
|
|
24429
|
+
}
|
|
24430
|
+
}
|
|
24431
|
+
|
|
24222
24432
|
class IncrementalAutoRenderPlugin {
|
|
24223
24433
|
constructor() {
|
|
24224
24434
|
this.name = 'IncrementalAutoRenderPlugin';
|
|
@@ -24561,6 +24771,9 @@ class Stage extends Group {
|
|
|
24561
24771
|
if (params.autoRender) {
|
|
24562
24772
|
this.enableAutoRender();
|
|
24563
24773
|
}
|
|
24774
|
+
if (params.autoRefresh) {
|
|
24775
|
+
this.enableAutoRefresh();
|
|
24776
|
+
}
|
|
24564
24777
|
if (params.disableDirtyBounds === false) {
|
|
24565
24778
|
this.enableDirtyBounds();
|
|
24566
24779
|
}
|
|
@@ -24732,6 +24945,22 @@ class Stage extends Group {
|
|
|
24732
24945
|
this.pluginService.unRegister(plugin);
|
|
24733
24946
|
});
|
|
24734
24947
|
}
|
|
24948
|
+
enableAutoRefresh() {
|
|
24949
|
+
if (this.autoRefresh) {
|
|
24950
|
+
return;
|
|
24951
|
+
}
|
|
24952
|
+
this.autoRefresh = true;
|
|
24953
|
+
this.pluginService.register(new AutoRefreshPlugin());
|
|
24954
|
+
}
|
|
24955
|
+
disableAutoRefresh() {
|
|
24956
|
+
if (!this.autoRefresh) {
|
|
24957
|
+
return;
|
|
24958
|
+
}
|
|
24959
|
+
this.autoRefresh = false;
|
|
24960
|
+
this.pluginService.findPluginsByName('AutoRefreshPlugin').forEach(plugin => {
|
|
24961
|
+
this.pluginService.unRegister(plugin);
|
|
24962
|
+
});
|
|
24963
|
+
}
|
|
24735
24964
|
enableIncrementalAutoRender() {
|
|
24736
24965
|
if (this.increaseAutoRender) {
|
|
24737
24966
|
return;
|
|
@@ -26143,56 +26372,12 @@ function simplifyRadialDist(points, sqTolerance) {
|
|
|
26143
26372
|
}
|
|
26144
26373
|
return newPoints;
|
|
26145
26374
|
}
|
|
26146
|
-
function simplifyDPStep(points, startIdx, endIdx, sqTolerance, simplified) {
|
|
26147
|
-
let maxSqDist = sqTolerance;
|
|
26148
|
-
let nextIdx = startIdx;
|
|
26149
|
-
const startX = points[startIdx].x;
|
|
26150
|
-
const startY = points[startIdx].y;
|
|
26151
|
-
const endX = points[endIdx].x;
|
|
26152
|
-
const endY = points[endIdx].y;
|
|
26153
|
-
const vecX2 = endX - startX;
|
|
26154
|
-
const vecY2 = endY - startY;
|
|
26155
|
-
const sqLength = vecX2 * vecX2 + vecY2 * vecY2;
|
|
26156
|
-
let area;
|
|
26157
|
-
let sqArea;
|
|
26158
|
-
let sqDistance;
|
|
26159
|
-
let vecX1;
|
|
26160
|
-
let vecY1;
|
|
26161
|
-
for (let i = startIdx + 1, len = endIdx - 1; i < len; i++) {
|
|
26162
|
-
vecX1 = points[i].x - startX;
|
|
26163
|
-
vecY1 = points[i].y - startY;
|
|
26164
|
-
area = vecX1 * vecY2 - vecX2 * vecY1;
|
|
26165
|
-
sqArea = area * area;
|
|
26166
|
-
sqDistance = sqArea / sqLength;
|
|
26167
|
-
if (sqDistance > maxSqDist) {
|
|
26168
|
-
maxSqDist = sqDistance;
|
|
26169
|
-
nextIdx = i;
|
|
26170
|
-
}
|
|
26171
|
-
}
|
|
26172
|
-
if (maxSqDist > sqTolerance) {
|
|
26173
|
-
if (nextIdx - startIdx > 2) {
|
|
26174
|
-
simplifyDPStep(points, startIdx, nextIdx, sqTolerance, simplified);
|
|
26175
|
-
}
|
|
26176
|
-
simplified.push(points[nextIdx], points[nextIdx + 1]);
|
|
26177
|
-
if (endIdx - nextIdx > 2) {
|
|
26178
|
-
simplifyDPStep(points, nextIdx, endIdx, sqTolerance, simplified);
|
|
26179
|
-
}
|
|
26180
|
-
}
|
|
26181
|
-
}
|
|
26182
|
-
function simplifyDouglasPeucker(points, sqTolerance) {
|
|
26183
|
-
const lastIdx = points.length - 1;
|
|
26184
|
-
const simplified = [points[0]];
|
|
26185
|
-
simplifyDPStep(points, 0, lastIdx, sqTolerance, simplified);
|
|
26186
|
-
simplified.push(points[lastIdx]);
|
|
26187
|
-
return simplified;
|
|
26188
|
-
}
|
|
26189
26375
|
function flatten_simplify(points, tolerance, highestQuality) {
|
|
26190
26376
|
if (points.length <= 10) {
|
|
26191
26377
|
return points;
|
|
26192
26378
|
}
|
|
26193
26379
|
const sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1;
|
|
26194
26380
|
points = highestQuality ? points : simplifyRadialDist(points, sqTolerance);
|
|
26195
|
-
points = simplifyDouglasPeucker(points, sqTolerance);
|
|
26196
26381
|
return points;
|
|
26197
26382
|
}
|
|
26198
26383
|
|