@visactor/vrender 0.17.19 → 0.17.20-alpha.1
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/index.d.ts +1 -1
- package/cjs/index.js +11 -10
- package/cjs/index.js.map +1 -1
- package/dist/index.js +254 -126
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2149,15 +2149,15 @@
|
|
|
2149
2149
|
};
|
|
2150
2150
|
var isArray$1 = isArray;
|
|
2151
2151
|
|
|
2152
|
-
var isNumber
|
|
2152
|
+
var isNumber = function isNumber(value) {
|
|
2153
2153
|
var fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
2154
2154
|
var type = _typeof(value);
|
|
2155
2155
|
return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
|
|
2156
2156
|
};
|
|
2157
|
-
var isNumber$
|
|
2157
|
+
var isNumber$1 = isNumber;
|
|
2158
2158
|
|
|
2159
2159
|
var isValidNumber = function isValidNumber(value) {
|
|
2160
|
-
return isNumber$
|
|
2160
|
+
return isNumber$1(value) && Number.isFinite(value);
|
|
2161
2161
|
};
|
|
2162
2162
|
var isValidNumber$1 = isValidNumber;
|
|
2163
2163
|
|
|
@@ -2264,12 +2264,12 @@
|
|
|
2264
2264
|
}, {
|
|
2265
2265
|
key: "add",
|
|
2266
2266
|
value: function add(point) {
|
|
2267
|
-
return isNumber$
|
|
2267
|
+
return isNumber$1(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
|
|
2268
2268
|
}
|
|
2269
2269
|
}, {
|
|
2270
2270
|
key: "sub",
|
|
2271
2271
|
value: function sub(point) {
|
|
2272
|
-
return isNumber$
|
|
2272
|
+
return isNumber$1(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
|
|
2273
2273
|
}
|
|
2274
2274
|
}, {
|
|
2275
2275
|
key: "multi",
|
|
@@ -2973,10 +2973,10 @@
|
|
|
2973
2973
|
return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
|
|
2974
2974
|
}
|
|
2975
2975
|
function rgb(value) {
|
|
2976
|
-
return isNumber$
|
|
2976
|
+
return isNumber$1(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
|
|
2977
2977
|
}
|
|
2978
2978
|
function rgba(value) {
|
|
2979
|
-
return isNumber$
|
|
2979
|
+
return isNumber$1(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
|
|
2980
2980
|
}
|
|
2981
2981
|
function SRGBToLinear(c) {
|
|
2982
2982
|
return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
|
|
@@ -3657,7 +3657,7 @@
|
|
|
3657
3657
|
}], [{
|
|
3658
3658
|
key: "getInstance",
|
|
3659
3659
|
value: function getInstance(level, method) {
|
|
3660
|
-
return Logger._instance && isNumber$
|
|
3660
|
+
return Logger._instance && isNumber$1(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
|
|
3661
3661
|
}
|
|
3662
3662
|
}, {
|
|
3663
3663
|
key: "setInstance",
|
|
@@ -5797,9 +5797,6 @@
|
|
|
5797
5797
|
function isNotAroundZero(val) {
|
|
5798
5798
|
return val > EPSILON || val < -EPSILON;
|
|
5799
5799
|
}
|
|
5800
|
-
function isNumber(data) {
|
|
5801
|
-
return "number" == typeof data && Number.isFinite(data);
|
|
5802
|
-
}
|
|
5803
5800
|
var _v0 = [0, 0],
|
|
5804
5801
|
_v1 = [0, 0],
|
|
5805
5802
|
_v2 = [0, 0];
|
|
@@ -9243,7 +9240,7 @@
|
|
|
9243
9240
|
key: "onBind",
|
|
9244
9241
|
value: function onBind() {
|
|
9245
9242
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
9246
|
-
this.fromNumber = isNumber$
|
|
9243
|
+
this.fromNumber = isNumber$1(null === (_a = this.from) || void 0 === _a ? void 0 : _a.text) ? null === (_b = this.from) || void 0 === _b ? void 0 : _b.text : Number.parseFloat(null === (_c = this.from) || void 0 === _c ? void 0 : _c.text), this.toNumber = isNumber$1(null === (_d = this.to) || void 0 === _d ? void 0 : _d.text) ? null === (_e = this.to) || void 0 === _e ? void 0 : _e.text : Number.parseFloat(null === (_f = this.to) || void 0 === _f ? void 0 : _f.text), Number.isFinite(this.toNumber) || (this.fromNumber = 0), Number.isFinite(this.toNumber) || (this.valid = !1), !1 !== this.valid && (this.decimalLength = null !== (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.fixed) && void 0 !== _h ? _h : Math.max(getDecimalPlaces(this.fromNumber), getDecimalPlaces(this.toNumber)));
|
|
9247
9244
|
}
|
|
9248
9245
|
}, {
|
|
9249
9246
|
key: "onEnd",
|
|
@@ -10654,7 +10651,7 @@
|
|
|
10654
10651
|
};
|
|
10655
10652
|
var samplingPoints = function samplingPoints(points, count) {
|
|
10656
10653
|
var validatePoints = points.filter(function (point) {
|
|
10657
|
-
return !1 !== point.defined && isNumber$
|
|
10654
|
+
return !1 !== point.defined && isNumber$1(point.x) && isNumber$1(point.y);
|
|
10658
10655
|
});
|
|
10659
10656
|
if (0 === validatePoints.length) return [];
|
|
10660
10657
|
if (1 === validatePoints.length) return new Array(count).fill(0).map(function (i) {
|
|
@@ -10694,7 +10691,7 @@
|
|
|
10694
10691
|
return res.concat(null !== (_a = seg.points) && void 0 !== _a ? _a : []);
|
|
10695
10692
|
}, []));
|
|
10696
10693
|
var validatePoints = points.filter(function (point) {
|
|
10697
|
-
return !1 !== point.defined && isNumber$
|
|
10694
|
+
return !1 !== point.defined && isNumber$1(point.x) && isNumber$1(point.y);
|
|
10698
10695
|
});
|
|
10699
10696
|
if (!validatePoints.length) return [];
|
|
10700
10697
|
var allPoints = [];
|
|
@@ -11524,7 +11521,7 @@
|
|
|
11524
11521
|
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
11525
11522
|
application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
11526
11523
|
var bounds = this.doUpdateAABBBounds(full);
|
|
11527
|
-
return
|
|
11524
|
+
return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), bounds;
|
|
11528
11525
|
}
|
|
11529
11526
|
}, {
|
|
11530
11527
|
key: "combindShadowAABBBounds",
|
|
@@ -14510,7 +14507,7 @@
|
|
|
14510
14507
|
_createClass(BaseSymbol, [{
|
|
14511
14508
|
key: "bounds",
|
|
14512
14509
|
value: function bounds(size, _bounds) {
|
|
14513
|
-
if (isNumber$
|
|
14510
|
+
if (isNumber$1(size)) {
|
|
14514
14511
|
var halfS = size / 2;
|
|
14515
14512
|
_bounds.x1 = -halfS, _bounds.x2 = halfS, _bounds.y1 = -halfS, _bounds.y2 = halfS;
|
|
14516
14513
|
} else _bounds.x1 = -size[0] / 2, _bounds.x2 = size[0] / 2, _bounds.y1 = -size[1] / 2, _bounds.y2 = size[1] / 2;
|
|
@@ -15197,12 +15194,12 @@
|
|
|
15197
15194
|
_createClass(RectSymbol, [{
|
|
15198
15195
|
key: "draw",
|
|
15199
15196
|
value: function draw(ctx, size, x, y) {
|
|
15200
|
-
return isNumber$
|
|
15197
|
+
return isNumber$1(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
|
|
15201
15198
|
}
|
|
15202
15199
|
}, {
|
|
15203
15200
|
key: "drawOffset",
|
|
15204
15201
|
value: function drawOffset(ctx, size, x, y, offset) {
|
|
15205
|
-
return isNumber$
|
|
15202
|
+
return isNumber$1(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
|
|
15206
15203
|
}
|
|
15207
15204
|
}]);
|
|
15208
15205
|
return RectSymbol;
|
|
@@ -15841,16 +15838,7 @@
|
|
|
15841
15838
|
deltaY = -height;
|
|
15842
15839
|
}
|
|
15843
15840
|
var deltaX = 0;
|
|
15844
|
-
|
|
15845
|
-
case "left":
|
|
15846
|
-
deltaX = 0;
|
|
15847
|
-
break;
|
|
15848
|
-
case "center":
|
|
15849
|
-
deltaX = -width / 2;
|
|
15850
|
-
break;
|
|
15851
|
-
case "right":
|
|
15852
|
-
deltaX = -width;
|
|
15853
|
-
}
|
|
15841
|
+
"right" === this.globalAlign || "end" === this.globalAlign ? deltaX = -width : "center" === this.globalAlign && (deltaX = -width / 2);
|
|
15854
15842
|
var frameHeight = this[this.directionKey.height];
|
|
15855
15843
|
this.singleLine && (frameHeight = this.lines[0].height + 1);
|
|
15856
15844
|
var lastLineTag = !1;
|
|
@@ -16003,9 +15991,9 @@
|
|
|
16003
15991
|
var direction = this.direction;
|
|
16004
15992
|
if (this.verticalEllipsis) text = "...", direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
|
|
16005
15993
|
if ("hide" === this.ellipsis) return;
|
|
16006
|
-
if ("add" === this.ellipsis) text += "...", "right"
|
|
15994
|
+
if ("add" === this.ellipsis) text += "...", "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
|
|
16007
15995
|
var index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
|
|
16008
|
-
if (text = text.slice(0, index), text += "...", "right" === textAlign) {
|
|
15996
|
+
if (text = text.slice(0, index), text += "...", "right" === textAlign || "end" === textAlign) {
|
|
16009
15997
|
var _measureTextCanvas3 = measureTextCanvas(this.text.slice(index), this.character),
|
|
16010
15998
|
width = _measureTextCanvas3.width;
|
|
16011
15999
|
"vertical" === direction || (left -= this.ellipsisWidth - width);
|
|
@@ -16261,17 +16249,7 @@
|
|
|
16261
16249
|
maxHeight = this.height;
|
|
16262
16250
|
var x = this.left,
|
|
16263
16251
|
spacing = 0;
|
|
16264
|
-
|
|
16265
|
-
case "right":
|
|
16266
|
-
x = width - this.actualWidth;
|
|
16267
|
-
break;
|
|
16268
|
-
case "center":
|
|
16269
|
-
x = (width - this.actualWidth) / 2;
|
|
16270
|
-
break;
|
|
16271
|
-
case "justify":
|
|
16272
|
-
this.paragraphs.length < 2 ? x = (width - this.actualWidth) / 2 : spacing = (width - this.actualWidth) / (this.paragraphs.length - 1);
|
|
16273
|
-
}
|
|
16274
|
-
this.paragraphs.map(function (paragraph) {
|
|
16252
|
+
this.actualWidth < width && !isWidthMax && ("right" === this.textAlign || "end" === this.textAlign ? x = width - this.actualWidth : "center" === this.textAlign ? x = (width - this.actualWidth) / 2 : "justify" === this.textAlign && (this.paragraphs.length < 2 ? x = (width - this.actualWidth) / 2 : spacing = (width - this.actualWidth) / (this.paragraphs.length - 1))), this.paragraphs.map(function (paragraph) {
|
|
16275
16253
|
paragraph instanceof RichTextIcon ? (paragraph["_" + directionKey.x] = x, x += paragraph[directionKey.width] + spacing, paragraph["_" + directionKey.y] = "top" === paragraph.attribute.textBaseline ? 0 : "bottom" === paragraph.attribute.textBaseline ? maxHeight - paragraph.height : (maxHeight - paragraph.height) / 2) : (paragraph[directionKey.left] = x, x += paragraph[directionKey.width] + spacing);
|
|
16276
16254
|
});
|
|
16277
16255
|
}
|
|
@@ -16554,7 +16532,7 @@
|
|
|
16554
16532
|
}
|
|
16555
16533
|
} else {
|
|
16556
16534
|
var richTextConfig = textConfig[i];
|
|
16557
|
-
if (isNumber$
|
|
16535
|
+
if (isNumber$1(richTextConfig.text) && (richTextConfig.text = "".concat(richTextConfig.text)), richTextConfig.text.includes("\n")) {
|
|
16558
16536
|
var textParts = richTextConfig.text.split("\n");
|
|
16559
16537
|
for (var j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, richTextConfig));
|
|
16560
16538
|
} else paragraphs.push(new Paragraph(richTextConfig.text, !1, richTextConfig));
|
|
@@ -16883,7 +16861,7 @@
|
|
|
16883
16861
|
innerRadius = _this$attribute2$inne === void 0 ? arcTheme.innerRadius : _this$attribute2$inne;
|
|
16884
16862
|
if (0 === cornerRadius || "0%" === cornerRadius) return 0;
|
|
16885
16863
|
var deltaRadius = Math.abs(outerRadius - innerRadius);
|
|
16886
|
-
return Math.min(isNumber$
|
|
16864
|
+
return Math.min(isNumber$1(cornerRadius, !0) ? cornerRadius : deltaRadius * parseFloat(cornerRadius) / 100, deltaRadius / 2);
|
|
16887
16865
|
}
|
|
16888
16866
|
}, {
|
|
16889
16867
|
key: "getParsedAngle",
|
|
@@ -19134,7 +19112,7 @@
|
|
|
19134
19112
|
var halfPi = pi / 2;
|
|
19135
19113
|
function createRectPath(path, x, y, width, height, rectCornerRadius) {
|
|
19136
19114
|
var cornerRadius;
|
|
19137
|
-
if (width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$
|
|
19115
|
+
if (width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$1(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) {
|
|
19138
19116
|
var cornerRadiusArr = rectCornerRadius;
|
|
19139
19117
|
var cr0, cr1;
|
|
19140
19118
|
switch (cornerRadiusArr.length) {
|
|
@@ -19257,7 +19235,7 @@
|
|
|
19257
19235
|
y = bounds.y1,
|
|
19258
19236
|
width = bounds.width(),
|
|
19259
19237
|
height = bounds.height();
|
|
19260
|
-
return isNumber$
|
|
19238
|
+
return isNumber$1(boundsPadding) ? (x += boundsPadding, y += boundsPadding, width -= 2 * boundsPadding, height -= 2 * boundsPadding) : (x += boundsPadding[3], y += boundsPadding[0], width -= boundsPadding[1] + boundsPadding[3], height -= boundsPadding[0] + boundsPadding[2]), {
|
|
19261
19239
|
x: x,
|
|
19262
19240
|
y: y,
|
|
19263
19241
|
width: width,
|
|
@@ -22219,20 +22197,26 @@
|
|
|
22219
22197
|
width = drawContext.width,
|
|
22220
22198
|
height = drawContext.height;
|
|
22221
22199
|
if (!context) return;
|
|
22200
|
+
if (drawContext.keepMatrix) {
|
|
22201
|
+
if (context.nativeContext && context.nativeContext.getTransform) {
|
|
22202
|
+
var t = context.nativeContext.getTransform();
|
|
22203
|
+
context.setTransformFromMatrix(t, !0, 1);
|
|
22204
|
+
}
|
|
22205
|
+
} else context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
|
|
22222
22206
|
var dirtyBounds = this.dirtyBounds.setValue(0, 0, width, height);
|
|
22223
22207
|
if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {
|
|
22224
22208
|
var b = getRectIntersect(dirtyBounds, stage.dirtyBounds, !1);
|
|
22225
22209
|
dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
|
|
22226
22210
|
}
|
|
22227
22211
|
var d = context.dpr % 1;
|
|
22228
|
-
(d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds)
|
|
22212
|
+
(d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds);
|
|
22229
22213
|
var drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
|
|
22230
22214
|
context.save(), context.translate(x, y, !0), drawInArea && (context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip()), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
|
|
22231
22215
|
var _a, _b;
|
|
22232
22216
|
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
|
|
22233
22217
|
}).forEach(function (group) {
|
|
22234
22218
|
group.isContainer ? _this2.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : _this2.renderItem(group, drawContext);
|
|
22235
|
-
}), context.restore(), context.restore(), context.draw(), context.inuse = !1;
|
|
22219
|
+
}), context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1);
|
|
22236
22220
|
}
|
|
22237
22221
|
}, {
|
|
22238
22222
|
key: "doRegister",
|
|
@@ -22695,7 +22679,7 @@
|
|
|
22695
22679
|
value: function draw(renderService, drawContext) {
|
|
22696
22680
|
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
22697
22681
|
var _this2 = this;
|
|
22698
|
-
var skipDraw, context, _drawContext$x, x, _drawContext$y, y;
|
|
22682
|
+
var skipDraw, context, _drawContext$x, x, _drawContext$y, y, t;
|
|
22699
22683
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
22700
22684
|
while (1) switch (_context.prev = _context.next) {
|
|
22701
22685
|
case 0:
|
|
@@ -22718,14 +22702,22 @@
|
|
|
22718
22702
|
case 8:
|
|
22719
22703
|
this.currentRenderService = renderService;
|
|
22720
22704
|
context = drawContext.context, _drawContext$x = drawContext.x, x = _drawContext$x === void 0 ? 0 : _drawContext$x, _drawContext$y = drawContext.y, y = _drawContext$y === void 0 ? 0 : _drawContext$y;
|
|
22721
|
-
|
|
22722
|
-
|
|
22723
|
-
|
|
22724
|
-
|
|
22725
|
-
|
|
22726
|
-
|
|
22727
|
-
|
|
22728
|
-
|
|
22705
|
+
if (context) {
|
|
22706
|
+
if (drawContext.keepMatrix) {
|
|
22707
|
+
if (context.nativeContext && context.nativeContext.getTransform) {
|
|
22708
|
+
t = context.nativeContext.getTransform();
|
|
22709
|
+
context.setTransformFromMatrix(t, !0, 1);
|
|
22710
|
+
}
|
|
22711
|
+
} else context.inuse = !0, context.clearMatrix();
|
|
22712
|
+
context.setTransformForCurrent(!0), context.save(), drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext), context.translate(x, y, !0), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
|
|
22713
|
+
var _a, _b;
|
|
22714
|
+
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
|
|
22715
|
+
}).forEach(function (group) {
|
|
22716
|
+
_this2.renderGroup(group, drawContext);
|
|
22717
|
+
}), this.hooks.completeDraw.tap("top-draw", function () {
|
|
22718
|
+
context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1), _this2.rendering = !1;
|
|
22719
|
+
});
|
|
22720
|
+
}
|
|
22729
22721
|
case 11:
|
|
22730
22722
|
case "end":
|
|
22731
22723
|
return _context.stop();
|
|
@@ -23299,13 +23291,23 @@
|
|
|
23299
23291
|
this.name = "FlexLayoutPlugin", this.activeEvent = "onRegister", this.id = Generator.GenAutoIncrementId(), this.key = this.name + this.id, this.tempBounds = new AABBBounds();
|
|
23300
23292
|
}
|
|
23301
23293
|
_createClass(FlexLayoutPlugin, [{
|
|
23294
|
+
key: "pauseLayout",
|
|
23295
|
+
value: function pauseLayout(p) {
|
|
23296
|
+
this.pause = p;
|
|
23297
|
+
}
|
|
23298
|
+
}, {
|
|
23299
|
+
key: "tryLayoutChildren",
|
|
23300
|
+
value: function tryLayoutChildren(graphic) {
|
|
23301
|
+
graphic.firstChild && this.tryLayout(graphic.firstChild);
|
|
23302
|
+
}
|
|
23303
|
+
}, {
|
|
23302
23304
|
key: "tryLayout",
|
|
23303
23305
|
value: function tryLayout(graphic) {
|
|
23304
23306
|
var _this = this;
|
|
23305
|
-
|
|
23306
|
-
this.
|
|
23307
|
+
var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
23308
|
+
if (this.pause) return;
|
|
23307
23309
|
var p = graphic.parent;
|
|
23308
|
-
if (!
|
|
23310
|
+
if (!(force || p && graphic.needUpdateLayout())) return;
|
|
23309
23311
|
var theme = getTheme(p).group,
|
|
23310
23312
|
_p$attribute$display = p.attribute.display,
|
|
23311
23313
|
display = _p$attribute$display === void 0 ? theme.display : _p$attribute$display;
|
|
@@ -23315,24 +23317,29 @@
|
|
|
23315
23317
|
flexDirection = _p$attribute$flexDire === void 0 ? theme.flexDirection : _p$attribute$flexDire,
|
|
23316
23318
|
_p$attribute$flexWrap = _p$attribute.flexWrap,
|
|
23317
23319
|
flexWrap = _p$attribute$flexWrap === void 0 ? theme.flexWrap : _p$attribute$flexWrap,
|
|
23318
|
-
_p$attribute$justifyC = _p$attribute.justifyContent,
|
|
23319
|
-
justifyContent = _p$attribute$justifyC === void 0 ? theme.justifyContent : _p$attribute$justifyC,
|
|
23320
23320
|
_p$attribute$alignIte = _p$attribute.alignItems,
|
|
23321
23321
|
alignItems = _p$attribute$alignIte === void 0 ? theme.alignItems : _p$attribute$alignIte,
|
|
23322
|
-
_p$attribute$alignCon = _p$attribute.alignContent,
|
|
23323
|
-
alignContent = _p$attribute$alignCon === void 0 ? theme.alignContent : _p$attribute$alignCon,
|
|
23324
23322
|
_p$attribute$clip = _p$attribute.clip,
|
|
23325
|
-
clip = _p$attribute$clip === void 0 ? theme.clip : _p$attribute$clip
|
|
23326
|
-
|
|
23327
|
-
|
|
23328
|
-
|
|
23329
|
-
|
|
23330
|
-
|
|
23331
|
-
|
|
23332
|
-
|
|
23333
|
-
var
|
|
23334
|
-
|
|
23335
|
-
|
|
23323
|
+
clip = _p$attribute$clip === void 0 ? theme.clip : _p$attribute$clip,
|
|
23324
|
+
_p$attribute$alignCon = p.attribute.alignContent,
|
|
23325
|
+
alignContent = _p$attribute$alignCon === void 0 ? null != alignItems ? alignItems : theme.alignContent : _p$attribute$alignCon;
|
|
23326
|
+
var _p$attribute2 = p.attribute,
|
|
23327
|
+
width = _p$attribute2.width,
|
|
23328
|
+
height = _p$attribute2.height,
|
|
23329
|
+
_p$attribute2$justify = _p$attribute2.justifyContent,
|
|
23330
|
+
justifyContent = _p$attribute2$justify === void 0 ? theme.justifyContent : _p$attribute2$justify;
|
|
23331
|
+
var children = p.getChildren();
|
|
23332
|
+
if (null == width || null == height) {
|
|
23333
|
+
var childrenWidth = 0,
|
|
23334
|
+
childrenHeight = 0,
|
|
23335
|
+
boundsLegal = 0;
|
|
23336
|
+
if (children.forEach(function (child) {
|
|
23337
|
+
var bounds = _this.getAABBBounds(child);
|
|
23338
|
+
bounds.empty() || ("column" === flexDirection || "column-reverse" === flexDirection ? (childrenHeight += bounds.height(), childrenWidth = Math.max(childrenWidth, bounds.width())) : (childrenWidth += bounds.width(), childrenHeight = Math.max(childrenHeight, bounds.height())), boundsLegal += bounds.x1, boundsLegal += bounds.y1, boundsLegal += bounds.x2, boundsLegal += bounds.y2);
|
|
23339
|
+
}), !isFinite(boundsLegal)) return;
|
|
23340
|
+
width = childrenWidth, height = childrenHeight;
|
|
23341
|
+
}
|
|
23342
|
+
p.attribute.width = width, p.attribute.height = height, this.tempBounds.copy(p._AABBBounds);
|
|
23336
23343
|
var result = {
|
|
23337
23344
|
main: {
|
|
23338
23345
|
len: width,
|
|
@@ -23341,18 +23348,18 @@
|
|
|
23341
23348
|
cross: {
|
|
23342
23349
|
len: height,
|
|
23343
23350
|
field: "y"
|
|
23344
|
-
}
|
|
23345
|
-
dir: 1
|
|
23351
|
+
}
|
|
23346
23352
|
},
|
|
23347
23353
|
main = result.main,
|
|
23348
23354
|
cross = result.cross;
|
|
23349
|
-
"
|
|
23355
|
+
"column" !== flexDirection && "column-reverse" !== flexDirection || (main.len = height, cross.len = width, main.field = "y", cross.field = "x"), "row-reverse" !== flexDirection && "column-reverse" !== flexDirection || ("flex-start" === justifyContent ? justifyContent = "flex-end" : "flex-end" === justifyContent ? justifyContent = "flex-start" : children.reverse());
|
|
23350
23356
|
var mainLen = 0,
|
|
23351
23357
|
crossLen = 0;
|
|
23352
23358
|
var mianLenArray = [];
|
|
23353
|
-
|
|
23354
|
-
var b = c
|
|
23355
|
-
|
|
23359
|
+
children.forEach(function (c) {
|
|
23360
|
+
var b = _this.getAABBBounds(c);
|
|
23361
|
+
if (b.empty()) return;
|
|
23362
|
+
var ml = "x" === main.field ? b.width() : b.height(),
|
|
23356
23363
|
cl = "x" === cross.field ? b.width() : b.height();
|
|
23357
23364
|
mianLenArray.push({
|
|
23358
23365
|
mainLen: ml,
|
|
@@ -23385,104 +23392,171 @@
|
|
|
23385
23392
|
mainLen: mainLen,
|
|
23386
23393
|
crossLen: crossLen
|
|
23387
23394
|
});
|
|
23388
|
-
var children = p.getChildren();
|
|
23389
23395
|
var lastIdx = 0;
|
|
23390
23396
|
if (mainList.forEach(function (s) {
|
|
23391
23397
|
_this.layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, s), lastIdx = s.idx + 1;
|
|
23392
23398
|
}), crossLen = mainList.reduce(function (a, b) {
|
|
23393
23399
|
return a + b.crossLen;
|
|
23394
23400
|
}, 0), 1 === mainList.length) {
|
|
23395
|
-
|
|
23396
|
-
|
|
23397
|
-
|
|
23398
|
-
|
|
23399
|
-
|
|
23400
|
-
|
|
23401
|
-
} else children.forEach(function (child) {
|
|
23402
|
-
child.attribute[cross.field] = getPadding(child, cross.field);
|
|
23403
|
-
});
|
|
23401
|
+
var anchorPosMap = {
|
|
23402
|
+
"flex-start": 0,
|
|
23403
|
+
"flex-end": cross.len,
|
|
23404
|
+
center: cross.len / 2
|
|
23405
|
+
};
|
|
23406
|
+
this.layoutCross(children, alignItems, cross, anchorPosMap, mianLenArray, mainList[0], 0);
|
|
23404
23407
|
} else if ("flex-start" === alignContent) {
|
|
23405
23408
|
lastIdx = 0;
|
|
23406
|
-
var
|
|
23409
|
+
var anchorPos = 0;
|
|
23407
23410
|
mainList.forEach(function (s, i) {
|
|
23408
|
-
|
|
23411
|
+
var anchorPosMap = {
|
|
23412
|
+
"flex-start": anchorPos,
|
|
23413
|
+
"flex-end": anchorPos + s.crossLen,
|
|
23414
|
+
center: anchorPos + s.crossLen / 2
|
|
23415
|
+
};
|
|
23416
|
+
_this.layoutCross(children, "flex-start", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen;
|
|
23409
23417
|
});
|
|
23410
23418
|
} else if ("center" === alignContent) {
|
|
23411
23419
|
lastIdx = 0;
|
|
23412
|
-
var
|
|
23420
|
+
var _anchorPos = Math.max(0, (cross.len - crossLen) / 2);
|
|
23413
23421
|
mainList.forEach(function (s, i) {
|
|
23414
|
-
|
|
23422
|
+
var anchorPosMap = {
|
|
23423
|
+
"flex-start": _anchorPos,
|
|
23424
|
+
"flex-end": _anchorPos + s.crossLen,
|
|
23425
|
+
center: _anchorPos + s.crossLen / 2
|
|
23426
|
+
};
|
|
23427
|
+
_this.layoutCross(children, "center", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos += s.crossLen;
|
|
23415
23428
|
});
|
|
23416
23429
|
} else if ("space-around" === alignContent) {
|
|
23417
23430
|
lastIdx = 0;
|
|
23418
23431
|
var padding = Math.max(0, (cross.len - crossLen) / mainList.length / 2);
|
|
23419
|
-
var
|
|
23432
|
+
var _anchorPos2 = padding;
|
|
23420
23433
|
mainList.forEach(function (s, i) {
|
|
23421
|
-
|
|
23434
|
+
var anchorPosMap = {
|
|
23435
|
+
"flex-start": _anchorPos2,
|
|
23436
|
+
"flex-end": _anchorPos2 + s.crossLen,
|
|
23437
|
+
center: _anchorPos2 + s.crossLen / 2
|
|
23438
|
+
};
|
|
23439
|
+
_this.layoutCross(children, "flex-start", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos2 += s.crossLen + 2 * padding;
|
|
23422
23440
|
});
|
|
23423
23441
|
} else if ("space-between" === alignContent) {
|
|
23424
23442
|
lastIdx = 0;
|
|
23425
23443
|
var _padding = Math.max(0, (cross.len - crossLen) / (2 * mainList.length - 2));
|
|
23426
|
-
var
|
|
23444
|
+
var _anchorPos3 = 0;
|
|
23427
23445
|
mainList.forEach(function (s, i) {
|
|
23428
|
-
|
|
23446
|
+
var anchorPosMap = {
|
|
23447
|
+
"flex-start": _anchorPos3,
|
|
23448
|
+
"flex-end": _anchorPos3 + s.crossLen,
|
|
23449
|
+
center: _anchorPos3 + s.crossLen / 2
|
|
23450
|
+
};
|
|
23451
|
+
_this.layoutCross(children, "flex-start", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, _anchorPos3 += s.crossLen + 2 * _padding;
|
|
23429
23452
|
});
|
|
23430
23453
|
}
|
|
23431
23454
|
children.forEach(function (child, idx) {
|
|
23432
23455
|
child.addUpdateBoundTag(), child.addUpdatePositionTag(), child.clearUpdateLayoutTag();
|
|
23433
|
-
}), p.addUpdateLayoutTag()
|
|
23456
|
+
}), p.addUpdateLayoutTag();
|
|
23457
|
+
var b = this.getAABBBounds(p);
|
|
23458
|
+
clip || this.tempBounds.equals(b) || this.tryLayout(p, !1);
|
|
23459
|
+
}
|
|
23460
|
+
}, {
|
|
23461
|
+
key: "getAABBBounds",
|
|
23462
|
+
value: function getAABBBounds(graphic) {
|
|
23463
|
+
this.skipBoundsTrigger = !0;
|
|
23464
|
+
var b = graphic.AABBBounds;
|
|
23465
|
+
return this.skipBoundsTrigger = !1, b;
|
|
23466
|
+
}
|
|
23467
|
+
}, {
|
|
23468
|
+
key: "updateChildPos",
|
|
23469
|
+
value: function updateChildPos(posBaseLeftTop, lastP, lastBP) {
|
|
23470
|
+
return posBaseLeftTop + (null != lastP ? lastP : 0) - lastBP;
|
|
23434
23471
|
}
|
|
23435
23472
|
}, {
|
|
23436
23473
|
key: "layoutMain",
|
|
23437
23474
|
value: function layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, currSeg) {
|
|
23438
23475
|
if ("flex-start" === justifyContent) {
|
|
23439
23476
|
var pos = 0;
|
|
23440
|
-
for (var i = lastIdx; i <= currSeg.idx; i++)
|
|
23477
|
+
for (var i = lastIdx; i <= currSeg.idx; i++) {
|
|
23478
|
+
var posBaseLeftTop = pos + getPadding(children[i], main.field),
|
|
23479
|
+
b = this.getAABBBounds(children[i]);
|
|
23480
|
+
!b.empty() && (children[i].attribute[main.field] = this.updateChildPos(posBaseLeftTop, children[i].attribute[main.field], b["".concat(main.field, "1")])), pos += mianLenArray[i].mainLen;
|
|
23481
|
+
}
|
|
23441
23482
|
} else if ("flex-end" === justifyContent) {
|
|
23442
23483
|
var _pos = main.len;
|
|
23443
|
-
for (var _i = lastIdx; _i <= currSeg.idx; _i++)
|
|
23484
|
+
for (var _i = lastIdx; _i <= currSeg.idx; _i++) {
|
|
23485
|
+
_pos -= mianLenArray[_i].mainLen;
|
|
23486
|
+
var _posBaseLeftTop = _pos + getPadding(children[_i], main.field),
|
|
23487
|
+
_b = this.getAABBBounds(children[_i]);
|
|
23488
|
+
!_b.empty() && (children[_i].attribute[main.field] = this.updateChildPos(_posBaseLeftTop, children[_i].attribute[main.field], _b["".concat(main.field, "1")]));
|
|
23489
|
+
}
|
|
23444
23490
|
} else if ("space-around" === justifyContent) {
|
|
23445
23491
|
if (currSeg.mainLen >= main.len) {
|
|
23446
23492
|
var _pos2 = 0;
|
|
23447
|
-
for (var _i2 = lastIdx; _i2 <= currSeg.idx; _i2++)
|
|
23493
|
+
for (var _i2 = lastIdx; _i2 <= currSeg.idx; _i2++) {
|
|
23494
|
+
var _posBaseLeftTop2 = _pos2 + getPadding(children[_i2], main.field),
|
|
23495
|
+
_b2 = this.getAABBBounds(children[_i2]);
|
|
23496
|
+
!_b2.empty() && (children[_i2].attribute[main.field] = this.updateChildPos(_posBaseLeftTop2, children[_i2].attribute[main.field], _b2["".concat(main.field, "1")])), _pos2 += mianLenArray[_i2].mainLen;
|
|
23497
|
+
}
|
|
23448
23498
|
} else {
|
|
23449
23499
|
var size = currSeg.idx - lastIdx + 1,
|
|
23450
23500
|
padding = (main.len - currSeg.mainLen) / size / 2;
|
|
23451
23501
|
var _pos3 = padding;
|
|
23452
|
-
for (var _i3 = lastIdx; _i3 <= currSeg.idx; _i3++)
|
|
23502
|
+
for (var _i3 = lastIdx; _i3 <= currSeg.idx; _i3++) {
|
|
23503
|
+
var _posBaseLeftTop3 = _pos3 + getPadding(children[_i3], main.field),
|
|
23504
|
+
_b3 = this.getAABBBounds(children[_i3]);
|
|
23505
|
+
!_b3.empty() && (children[_i3].attribute[main.field] = this.updateChildPos(_posBaseLeftTop3, children[_i3].attribute[main.field], _b3["".concat(main.field, "1")])), _pos3 += mianLenArray[_i3].mainLen + 2 * padding;
|
|
23506
|
+
}
|
|
23453
23507
|
}
|
|
23454
23508
|
} else if ("space-between" === justifyContent) {
|
|
23455
23509
|
if (currSeg.mainLen >= main.len) {
|
|
23456
23510
|
var _pos4 = 0;
|
|
23457
|
-
for (var _i4 = lastIdx; _i4 <= currSeg.idx; _i4++)
|
|
23511
|
+
for (var _i4 = lastIdx; _i4 <= currSeg.idx; _i4++) {
|
|
23512
|
+
var _posBaseLeftTop4 = _pos4 + getPadding(children[_i4], main.field),
|
|
23513
|
+
_b4 = this.getAABBBounds(children[_i4]);
|
|
23514
|
+
!_b4.empty() && (children[_i4].attribute[main.field] = this.updateChildPos(_posBaseLeftTop4, children[_i4].attribute[main.field], _b4["".concat(main.field, "1")])), _pos4 += mianLenArray[_i4].mainLen;
|
|
23515
|
+
}
|
|
23458
23516
|
} else {
|
|
23459
23517
|
var _size = currSeg.idx - lastIdx + 1,
|
|
23460
23518
|
_padding2 = (main.len - currSeg.mainLen) / (2 * _size - 2);
|
|
23461
23519
|
var _pos5 = 0;
|
|
23462
|
-
for (var _i5 = lastIdx; _i5 <= currSeg.idx; _i5++)
|
|
23520
|
+
for (var _i5 = lastIdx; _i5 <= currSeg.idx; _i5++) {
|
|
23521
|
+
var _posBaseLeftTop5 = _pos5 + getPadding(children[_i5], main.field),
|
|
23522
|
+
_b5 = this.getAABBBounds(children[_i5]);
|
|
23523
|
+
!_b5.empty() && (children[_i5].attribute[main.field] = this.updateChildPos(_posBaseLeftTop5, children[_i5].attribute[main.field], _b5["".concat(main.field, "1")])), _pos5 += mianLenArray[_i5].mainLen + 2 * _padding2;
|
|
23524
|
+
}
|
|
23463
23525
|
}
|
|
23464
23526
|
} else if ("center" === justifyContent) {
|
|
23465
23527
|
var _pos6 = (main.len - currSeg.mainLen) / 2;
|
|
23466
|
-
for (var _i6 = lastIdx; _i6 <= currSeg.idx; _i6++)
|
|
23528
|
+
for (var _i6 = lastIdx; _i6 <= currSeg.idx; _i6++) {
|
|
23529
|
+
var _posBaseLeftTop6 = _pos6 + getPadding(children[_i6], main.field),
|
|
23530
|
+
_b6 = this.getAABBBounds(children[_i6]);
|
|
23531
|
+
!_b6.empty() && (children[_i6].attribute[main.field] = this.updateChildPos(_posBaseLeftTop6, children[_i6].attribute[main.field], _b6["".concat(main.field, "1")])), _pos6 += mianLenArray[_i6].mainLen;
|
|
23532
|
+
}
|
|
23467
23533
|
}
|
|
23468
23534
|
}
|
|
23469
23535
|
}, {
|
|
23470
23536
|
key: "layoutCross",
|
|
23471
|
-
value: function layoutCross(children, alignItem, cross,
|
|
23472
|
-
|
|
23537
|
+
value: function layoutCross(children, alignItem, cross, anchorPosMap, lenArray, currSeg, lastIdx) {
|
|
23538
|
+
var _a;
|
|
23539
|
+
for (var i = lastIdx; i <= currSeg.idx; i++) {
|
|
23540
|
+
var child = children[i];
|
|
23541
|
+
var alignSelf = child.attribute.alignSelf;
|
|
23542
|
+
alignSelf && "auto" !== alignSelf || (alignSelf = alignItem);
|
|
23543
|
+
var b = this.getAABBBounds(child),
|
|
23544
|
+
anchorPos = null !== (_a = anchorPosMap[alignSelf]) && void 0 !== _a ? _a : anchorPosMap["flex-start"];
|
|
23545
|
+
"flex-end" === alignSelf ? !b.empty() && (child.attribute[cross.field] = this.updateChildPos(anchorPos - lenArray[i].crossLen + getPadding(child, cross.field), child.attribute[cross.field], b["".concat(cross.field, "1")])) : "center" === alignSelf ? !b.empty() && (child.attribute[cross.field] = this.updateChildPos(anchorPos - lenArray[i].crossLen / 2 + getPadding(child, cross.field), child.attribute[cross.field], b["".concat(cross.field, "1")])) : !b.empty() && (child.attribute[cross.field] = this.updateChildPos(anchorPos + getPadding(child, cross.field), child.attribute[cross.field], b["".concat(cross.field, "1")]));
|
|
23546
|
+
}
|
|
23473
23547
|
}
|
|
23474
23548
|
}, {
|
|
23475
23549
|
key: "activate",
|
|
23476
23550
|
value: function activate(context) {
|
|
23477
23551
|
var _this2 = this;
|
|
23478
23552
|
this.pluginService = context, application.graphicService.hooks.onAttributeUpdate.tap(this.key, function (graphic) {
|
|
23479
|
-
graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic
|
|
23553
|
+
graphic.glyphHost && (graphic = graphic.glyphHost), graphic.stage && graphic.stage === _this2.pluginService.stage && _this2.tryLayout(graphic, !1);
|
|
23480
23554
|
}), application.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, function (graphic, stage, willUpdate, bounds) {
|
|
23481
|
-
graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === _this2.pluginService.stage && graphic.isContainer && _tempBounds.copy(bounds);
|
|
23555
|
+
graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === _this2.pluginService.stage && graphic.isContainer && !_this2.skipBoundsTrigger && _tempBounds.copy(bounds);
|
|
23482
23556
|
}), application.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, function (graphic, stage, bounds, params, selfChange) {
|
|
23483
|
-
stage && stage === _this2.pluginService.stage && graphic.isContainer && (_tempBounds.equals(bounds) ||
|
|
23557
|
+
stage && stage === _this2.pluginService.stage && graphic.isContainer && !_this2.skipBoundsTrigger && (_tempBounds.equals(bounds) || _this2.tryLayout(graphic, !1));
|
|
23484
23558
|
}), application.graphicService.hooks.onSetStage.tap(this.key, function (graphic) {
|
|
23485
|
-
graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic
|
|
23559
|
+
graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic, !1);
|
|
23486
23560
|
});
|
|
23487
23561
|
}
|
|
23488
23562
|
}, {
|
|
@@ -23491,6 +23565,10 @@
|
|
|
23491
23565
|
var _this3 = this;
|
|
23492
23566
|
application.graphicService.hooks.onAttributeUpdate.taps = application.graphicService.hooks.onAttributeUpdate.taps.filter(function (item) {
|
|
23493
23567
|
return item.name !== _this3.key;
|
|
23568
|
+
}), application.graphicService.hooks.beforeUpdateAABBBounds.taps = application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(function (item) {
|
|
23569
|
+
return item.name !== _this3.key;
|
|
23570
|
+
}), application.graphicService.hooks.afterUpdateAABBBounds.taps = application.graphicService.hooks.afterUpdateAABBBounds.taps.filter(function (item) {
|
|
23571
|
+
return item.name !== _this3.key;
|
|
23494
23572
|
}), application.graphicService.hooks.onSetStage.taps = application.graphicService.hooks.onSetStage.taps.filter(function (item) {
|
|
23495
23573
|
return item.name !== _this3.key;
|
|
23496
23574
|
});
|
|
@@ -23499,11 +23577,7 @@
|
|
|
23499
23577
|
return FlexLayoutPlugin;
|
|
23500
23578
|
}();
|
|
23501
23579
|
function getPadding(graphic, field) {
|
|
23502
|
-
|
|
23503
|
-
if (isNumber(graphic.attribute.boundsPadding)) return graphic.attribute.boundsPadding;
|
|
23504
|
-
if (isArray$1(graphic.attribute.boundsPadding) && 1 === graphic.attribute.boundsPadding.length) return graphic.attribute.boundsPadding[0];
|
|
23505
|
-
var paddingArray = parsePadding(graphic.attribute.boundsPadding);
|
|
23506
|
-
return "x" === field ? paddingArray[3] : "y" === field ? paddingArray[0] : 0;
|
|
23580
|
+
return 0;
|
|
23507
23581
|
}
|
|
23508
23582
|
|
|
23509
23583
|
var defaultTicker = new DefaultTicker();
|
|
@@ -24027,6 +24101,11 @@
|
|
|
24027
24101
|
_this7.pluginService.unRegister(plugin);
|
|
24028
24102
|
}));
|
|
24029
24103
|
}
|
|
24104
|
+
}, {
|
|
24105
|
+
key: "getPluginsByName",
|
|
24106
|
+
value: function getPluginsByName(name) {
|
|
24107
|
+
return this.pluginService.findPluginsByName(name);
|
|
24108
|
+
}
|
|
24030
24109
|
}, {
|
|
24031
24110
|
key: "tryUpdateAABBBounds",
|
|
24032
24111
|
value: function tryUpdateAABBBounds() {
|
|
@@ -24077,7 +24156,7 @@
|
|
|
24077
24156
|
value: function render(layers, params) {
|
|
24078
24157
|
this.ticker.start(), this.timeline.resume();
|
|
24079
24158
|
var state = this.state;
|
|
24080
|
-
this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this.renderLayerList(this.children), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear(), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
|
|
24159
|
+
this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this.renderLayerList(this.children, params), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear(), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
|
|
24081
24160
|
}
|
|
24082
24161
|
}, {
|
|
24083
24162
|
key: "combineLayersToWindow",
|
|
@@ -24114,7 +24193,8 @@
|
|
|
24114
24193
|
background: layer === _this10.defaultLayer ? _this10.background : void 0,
|
|
24115
24194
|
updateBounds: !(!_this10.dirtyBounds || _this10.dirtyBounds.empty())
|
|
24116
24195
|
}, Object.assign({
|
|
24117
|
-
renderStyle: _this10.renderStyle
|
|
24196
|
+
renderStyle: _this10.renderStyle,
|
|
24197
|
+
keepMatrix: _this10.params.renderKeepMatrix
|
|
24118
24198
|
}, params)));
|
|
24119
24199
|
}), this.interactiveLayer && !layerList.includes(this.interactiveLayer) && this.interactiveLayer.render({
|
|
24120
24200
|
renderService: this.renderService,
|
|
@@ -25016,11 +25096,17 @@
|
|
|
25016
25096
|
if (!params.bounds.contains(point.x, point.y)) return result;
|
|
25017
25097
|
offsetX = params.bounds.x1, offsetY = params.bounds.y1;
|
|
25018
25098
|
}
|
|
25019
|
-
|
|
25099
|
+
if (this.pickContext) if (params.keepMatrix) {
|
|
25100
|
+
if (this.pickContext.nativeContext && this.pickContext.nativeContext.getTransform) {
|
|
25101
|
+
var t = this.pickContext.nativeContext.getTransform();
|
|
25102
|
+
this.pickContext.setTransformFromMatrix(t, !0, 1);
|
|
25103
|
+
}
|
|
25104
|
+
} else this.pickContext.inuse = !0, this.pickContext.clearMatrix(!0, 1);
|
|
25105
|
+
params.pickContext = this.pickContext;
|
|
25020
25106
|
var parentMatrix = new Matrix(1, 0, 0, 1, offsetX, offsetY);
|
|
25021
25107
|
var group;
|
|
25022
25108
|
for (var i = graphics.length - 1; i >= 0 && (result = graphics[i].isContainer ? this.pickGroup(graphics[i], point, parentMatrix, params) : this.pickItem(graphics[i], point, parentMatrix, params), !result.graphic); i--) group || (group = result.group);
|
|
25023
|
-
if (result.graphic || (result.group = group), this.pickContext && (this.pickContext.inuse = !1), result.graphic) {
|
|
25109
|
+
if (result.graphic || (result.group = group), this.pickContext && !params.keepMatrix && (this.pickContext.inuse = !1), result.graphic) {
|
|
25024
25110
|
var g = result.graphic;
|
|
25025
25111
|
for (; g.parent;) g = g.parent;
|
|
25026
25112
|
g.shadowHost && (result.params = {
|
|
@@ -28929,9 +29015,9 @@
|
|
|
28929
29015
|
}
|
|
28930
29016
|
children.length && flatten(1 === children.length ? children[0] : children, childrenList);
|
|
28931
29017
|
var g = "Group" === c.name ? new c(attribute) : c(config);
|
|
28932
|
-
return parseToGraphic(g, childrenList, props), stateProxy && (g.stateProxy = stateProxy), g;
|
|
29018
|
+
return parseToGraphic$1(g, childrenList, props), stateProxy && (g.stateProxy = stateProxy), g;
|
|
28933
29019
|
}
|
|
28934
|
-
function parseToGraphic(g, childrenList, props) {
|
|
29020
|
+
function parseToGraphic$1(g, childrenList, props) {
|
|
28935
29021
|
var out,
|
|
28936
29022
|
isGraphic = !1;
|
|
28937
29023
|
switch (g.type) {
|
|
@@ -28957,6 +29043,47 @@
|
|
|
28957
29043
|
}
|
|
28958
29044
|
var Fragment = Group;
|
|
28959
29045
|
|
|
29046
|
+
function decodeReactDom(dom) {
|
|
29047
|
+
if (!dom || !dom.$$typeof) return dom;
|
|
29048
|
+
var type = dom.type,
|
|
29049
|
+
_dom$props = dom.props,
|
|
29050
|
+
attribute = _dom$props.attribute,
|
|
29051
|
+
children = _dom$props.children,
|
|
29052
|
+
stateProxy = _dom$props.stateProxy,
|
|
29053
|
+
g = type({
|
|
29054
|
+
attribute: attribute
|
|
29055
|
+
}),
|
|
29056
|
+
out = parseToGraphic(g, dom.props, children);
|
|
29057
|
+
return out || (stateProxy && (g.stateProxy = stateProxy), g.id = attribute.id, g.name = attribute.name, isArray$1(children) ? children.forEach(function (item) {
|
|
29058
|
+
var c = decodeReactDom(item);
|
|
29059
|
+
c && c.type && g.add(c);
|
|
29060
|
+
}) : children && g.add(decodeReactDom(children)), g);
|
|
29061
|
+
}
|
|
29062
|
+
function parseToGraphic(g, props, childrenList) {
|
|
29063
|
+
var out,
|
|
29064
|
+
isGraphic = !1;
|
|
29065
|
+
switch (g.type) {
|
|
29066
|
+
case "richtext":
|
|
29067
|
+
break;
|
|
29068
|
+
case "rich/text":
|
|
29069
|
+
out = g.attribute || {}, childrenList && (out.text = childrenList), g.attribute = out;
|
|
29070
|
+
break;
|
|
29071
|
+
case "rich/image":
|
|
29072
|
+
out = g.attribute || {};
|
|
29073
|
+
break;
|
|
29074
|
+
default:
|
|
29075
|
+
isGraphic = !0;
|
|
29076
|
+
}
|
|
29077
|
+
return isGraphic ? Object.keys(props).forEach(function (k) {
|
|
29078
|
+
var en = REACT_TO_CANOPUS_EVENTS[k];
|
|
29079
|
+
en && g.on(en, props[k]);
|
|
29080
|
+
}) : "richtext" === g.type && (g.attribute.textConfig = childrenList.map(function (item) {
|
|
29081
|
+
return decodeReactDom(item);
|
|
29082
|
+
}).filter(function (item) {
|
|
29083
|
+
return item;
|
|
29084
|
+
})), out;
|
|
29085
|
+
}
|
|
29086
|
+
|
|
28960
29087
|
var DragNDrop = /*#__PURE__*/function () {
|
|
28961
29088
|
function DragNDrop(rootNode) {
|
|
28962
29089
|
var _this = this;
|
|
@@ -33408,7 +33535,7 @@
|
|
|
33408
33535
|
x += _point.x, y += _point.y, pickContext.setTransformForCurrent();
|
|
33409
33536
|
} else x = 0, y = 0, onlyTranslate = !1, pickContext.transformFromMatrix(rect.transMatrix, !0);
|
|
33410
33537
|
var picked = !0;
|
|
33411
|
-
if (!onlyTranslate || rect.shadowRoot || isNumber$
|
|
33538
|
+
if (!onlyTranslate || rect.shadowRoot || isNumber$1(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(function (num) {
|
|
33412
33539
|
return 0 !== num;
|
|
33413
33540
|
})) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, function (context, rectAttribute, themeAttribute) {
|
|
33414
33541
|
return !!picked || (picked = context.isPointInPath(point.x, point.y), picked);
|
|
@@ -33486,7 +33613,7 @@
|
|
|
33486
33613
|
x += _point.x, y += _point.y, pickContext.setTransformForCurrent();
|
|
33487
33614
|
} else x = 0, y = 0, onlyTranslate = !1, pickContext.transformFromMatrix(rect.transMatrix, !0);
|
|
33488
33615
|
var picked = !0;
|
|
33489
|
-
if (!onlyTranslate || isNumber$
|
|
33616
|
+
if (!onlyTranslate || isNumber$1(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(function (num) {
|
|
33490
33617
|
return 0 !== num;
|
|
33491
33618
|
})) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, function (context, rectAttribute, themeAttribute) {
|
|
33492
33619
|
return !!picked || (picked = context.isPointInPath(point.x, point.y), picked);
|
|
@@ -34853,7 +34980,7 @@
|
|
|
34853
34980
|
|
|
34854
34981
|
var roughModule = _roughModule;
|
|
34855
34982
|
|
|
34856
|
-
const version = "0.17.
|
|
34983
|
+
const version = "0.17.20-alpha.1";
|
|
34857
34984
|
preLoadAllModule();
|
|
34858
34985
|
if (isBrowserEnv()) {
|
|
34859
34986
|
loadBrowserEnv(container);
|
|
@@ -35183,6 +35310,7 @@
|
|
|
35183
35310
|
exports.cubicLength = cubicLength;
|
|
35184
35311
|
exports.cubicPointAt = cubicPointAt;
|
|
35185
35312
|
exports.cubicSubdivide = cubicSubdivide;
|
|
35313
|
+
exports.decodeReactDom = decodeReactDom;
|
|
35186
35314
|
exports.defaultArcAllocate = defaultArcAllocate;
|
|
35187
35315
|
exports.defaultArcBackgroundRenderContribution = defaultArcBackgroundRenderContribution;
|
|
35188
35316
|
exports.defaultArcRenderContribution = defaultArcRenderContribution;
|