@antv/g-lite 1.0.12 → 1.0.13
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/dist/Canvas.d.ts.map +1 -1
- package/dist/css/StyleValueRegistry.d.ts +1 -1
- package/dist/css/StyleValueRegistry.d.ts.map +1 -1
- package/dist/display-objects/DisplayObject.d.ts +1 -0
- package/dist/display-objects/DisplayObject.d.ts.map +1 -1
- package/dist/display-objects/Line.d.ts +2 -2
- package/dist/display-objects/Line.d.ts.map +1 -1
- package/dist/display-objects/Path.d.ts +2 -2
- package/dist/display-objects/Path.d.ts.map +1 -1
- package/dist/display-objects/Polyline.d.ts +2 -2
- package/dist/display-objects/Polyline.d.ts.map +1 -1
- package/dist/display-objects/Text.d.ts +2 -2
- package/dist/display-objects/Text.d.ts.map +1 -1
- package/dist/dom/EventTarget.d.ts +1 -1
- package/dist/dom/EventTarget.d.ts.map +1 -1
- package/dist/dom/interfaces.d.ts +1 -1
- package/dist/dom/interfaces.d.ts.map +1 -1
- package/dist/index.esm.js +150 -103
- package/dist/index.js +150 -103
- package/dist/index.umd.js +155 -110
- package/dist/index.umd.min.js +2 -2
- package/dist/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/dist/plugins/PrepareRendererPlugin.d.ts.map +1 -1
- package/dist/services/EventService.d.ts +1 -1
- package/dist/services/EventService.d.ts.map +1 -1
- package/dist/services/RenderingService.d.ts.map +1 -1
- package/dist/services/SceneGraphService.d.ts.map +1 -1
- package/dist/services/TextService.d.ts.map +1 -1
- package/dist/utils/assert.d.ts +4 -1
- package/dist/utils/assert.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -561,10 +561,7 @@ var FORMAT_ATTR_MAP = {
|
|
|
561
561
|
alias: 'lineWidth'
|
|
562
562
|
},
|
|
563
563
|
textAnchor: {
|
|
564
|
-
alias: 'textAlign'
|
|
565
|
-
values: {
|
|
566
|
-
middle: 'center'
|
|
567
|
-
}
|
|
564
|
+
alias: 'textAlign'
|
|
568
565
|
},
|
|
569
566
|
src: {
|
|
570
567
|
alias: 'img'
|
|
@@ -574,18 +571,8 @@ var formatAttributeName = memoize(function (name) {
|
|
|
574
571
|
var attributeName = camelCase(name);
|
|
575
572
|
var map = FORMAT_ATTR_MAP[attributeName];
|
|
576
573
|
attributeName = (map === null || map === void 0 ? void 0 : map.alias) || attributeName;
|
|
577
|
-
return
|
|
574
|
+
return attributeName;
|
|
578
575
|
});
|
|
579
|
-
function formatAttribute(name, value) {
|
|
580
|
-
var _map$values;
|
|
581
|
-
|
|
582
|
-
var _formatAttributeName = formatAttributeName(name),
|
|
583
|
-
attributeName = _formatAttributeName[0],
|
|
584
|
-
map = _formatAttributeName[1];
|
|
585
|
-
|
|
586
|
-
var attributeValue = isString(value) && (map === null || map === void 0 ? void 0 : (_map$values = map.values) === null || _map$values === void 0 ? void 0 : _map$values[value]) || value;
|
|
587
|
-
return [attributeName, attributeValue];
|
|
588
|
-
}
|
|
589
576
|
|
|
590
577
|
var canvasMap = {};
|
|
591
578
|
var defaultCanvasIdCounter = 0;
|
|
@@ -5445,16 +5432,23 @@ var CSSPropertyOffsetDistance = /*#__PURE__*/function () {
|
|
|
5445
5432
|
};
|
|
5446
5433
|
|
|
5447
5434
|
_proto.postProcessor = function postProcessor(object) {
|
|
5448
|
-
|
|
5435
|
+
var _object$parsedStyle = object.parsedStyle,
|
|
5436
|
+
offsetPath = _object$parsedStyle.offsetPath,
|
|
5437
|
+
offsetDistance = _object$parsedStyle.offsetDistance;
|
|
5438
|
+
|
|
5439
|
+
if (!offsetPath) {
|
|
5449
5440
|
return;
|
|
5450
5441
|
}
|
|
5451
5442
|
|
|
5452
|
-
var
|
|
5443
|
+
var nodeName = offsetPath.nodeName;
|
|
5453
5444
|
|
|
5454
|
-
if (
|
|
5455
|
-
|
|
5445
|
+
if (nodeName === Shape.LINE || nodeName === Shape.PATH || nodeName === Shape.POLYLINE) {
|
|
5446
|
+
// set position in world space
|
|
5447
|
+
var point = offsetPath.getPoint(offsetDistance);
|
|
5456
5448
|
|
|
5457
5449
|
if (point) {
|
|
5450
|
+
object.parsedStyle.defX = point.x;
|
|
5451
|
+
object.parsedStyle.defY = point.y;
|
|
5458
5452
|
object.setLocalPosition(point.x, point.y);
|
|
5459
5453
|
}
|
|
5460
5454
|
}
|
|
@@ -8560,7 +8554,7 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
8560
8554
|
n: 'textAlign',
|
|
8561
8555
|
l: true,
|
|
8562
8556
|
inh: true,
|
|
8563
|
-
k: ['start', 'center', 'end', 'left', 'right'],
|
|
8557
|
+
k: ['start', 'center', 'middle', 'end', 'left', 'right'],
|
|
8564
8558
|
d: 'start'
|
|
8565
8559
|
}, // {
|
|
8566
8560
|
// n: 'whiteSpace',
|
|
@@ -8672,12 +8666,10 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
8672
8666
|
attributeNames.forEach(function (attributeName) {
|
|
8673
8667
|
var _propertyMetadataCach;
|
|
8674
8668
|
|
|
8675
|
-
var
|
|
8676
|
-
name = _formatAttribute[0],
|
|
8677
|
-
value = _formatAttribute[1];
|
|
8669
|
+
var name = formatAttributeName(attributeName);
|
|
8678
8670
|
|
|
8679
8671
|
if (!skipUpdateAttribute) {
|
|
8680
|
-
object.attributes[name] =
|
|
8672
|
+
object.attributes[name] = attributes[attributeName];
|
|
8681
8673
|
}
|
|
8682
8674
|
|
|
8683
8675
|
if (!needUpdateGeometry && ((_propertyMetadataCach = propertyMetadataCache[name]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.l)) {
|
|
@@ -9461,7 +9453,11 @@ var EventTarget = /*#__PURE__*/function () {
|
|
|
9461
9453
|
*/
|
|
9462
9454
|
;
|
|
9463
9455
|
|
|
9464
|
-
_proto.dispatchEvent = function dispatchEvent(e) {
|
|
9456
|
+
_proto.dispatchEvent = function dispatchEvent(e, skipPropagate) {
|
|
9457
|
+
if (skipPropagate === void 0) {
|
|
9458
|
+
skipPropagate = false;
|
|
9459
|
+
}
|
|
9460
|
+
|
|
9465
9461
|
if (!(e instanceof FederatedEvent)) {
|
|
9466
9462
|
throw new Error('DisplayObject cannot propagate events outside of the Federated Events API');
|
|
9467
9463
|
} // should account for Element / Document / Canvas
|
|
@@ -9491,8 +9487,12 @@ var EventTarget = /*#__PURE__*/function () {
|
|
|
9491
9487
|
|
|
9492
9488
|
e.defaultPrevented = false;
|
|
9493
9489
|
e.path = [];
|
|
9494
|
-
|
|
9495
|
-
(
|
|
9490
|
+
|
|
9491
|
+
if (!skipPropagate) {
|
|
9492
|
+
e.target = this;
|
|
9493
|
+
}
|
|
9494
|
+
|
|
9495
|
+
(_e$manager = e.manager) === null || _e$manager === void 0 ? void 0 : _e$manager.dispatchEvent(e, e.type, skipPropagate);
|
|
9496
9496
|
}
|
|
9497
9497
|
|
|
9498
9498
|
return !e.defaultPrevented;
|
|
@@ -10812,9 +10812,7 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
10812
10812
|
var value = this.attributes[name];
|
|
10813
10813
|
|
|
10814
10814
|
if (value === undefined) {
|
|
10815
|
-
var
|
|
10816
|
-
attributeName = _formatAttribute[0];
|
|
10817
|
-
|
|
10815
|
+
var attributeName = formatAttributeName(name);
|
|
10818
10816
|
value = this.attributes[attributeName]; // if the given attribute does not exist, the value returned will either be null or ""
|
|
10819
10817
|
|
|
10820
10818
|
return isNil(value) ? null : value;
|
|
@@ -11223,6 +11221,7 @@ var DEFAULT_PARSED_STYLE_PROPS = {
|
|
|
11223
11221
|
filter: [],
|
|
11224
11222
|
shadowType: 'outer'
|
|
11225
11223
|
};
|
|
11224
|
+
var INHERITABLE_STYLE_PROPS = ['opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform'];
|
|
11226
11225
|
/**
|
|
11227
11226
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
11228
11227
|
*
|
|
@@ -11262,6 +11261,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11262
11261
|
|
|
11263
11262
|
_this.config = void 0;
|
|
11264
11263
|
_this.isCustomElement = false;
|
|
11264
|
+
_this.isMutationObserved = false;
|
|
11265
11265
|
_this.activeAnimations = [];
|
|
11266
11266
|
|
|
11267
11267
|
_this.getClip = function () {
|
|
@@ -11396,14 +11396,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11396
11396
|
|
|
11397
11397
|
runtime.styleValueRegistry.processProperties(this, attributes, {
|
|
11398
11398
|
forceUpdateGeometry: true,
|
|
11399
|
-
usedAttributes:
|
|
11400
|
-
// 'transform',
|
|
11401
|
-
// 'zIndex',
|
|
11402
|
-
// 'filter',
|
|
11403
|
-
// 'shadowType',
|
|
11404
|
-
// 'fill',
|
|
11405
|
-
// 'stroke',
|
|
11406
|
-
'opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform']
|
|
11399
|
+
usedAttributes: INHERITABLE_STYLE_PROPS
|
|
11407
11400
|
}); // redraw at next frame
|
|
11408
11401
|
|
|
11409
11402
|
renderable.dirty = true;
|
|
@@ -11414,19 +11407,16 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11414
11407
|
force = false;
|
|
11415
11408
|
}
|
|
11416
11409
|
|
|
11417
|
-
var
|
|
11418
|
-
attributeName = _formatAttribute[0],
|
|
11419
|
-
attributeValue = _formatAttribute[1]; // ignore undefined value
|
|
11420
|
-
|
|
11410
|
+
var attributeName = formatAttributeName(name); // ignore undefined value
|
|
11421
11411
|
|
|
11422
11412
|
if (isUndefined(value)) {
|
|
11423
11413
|
return;
|
|
11424
11414
|
}
|
|
11425
11415
|
|
|
11426
|
-
if (force ||
|
|
11427
|
-
this.internalSetAttribute(attributeName,
|
|
11416
|
+
if (force || value !== this.attributes[attributeName]) {
|
|
11417
|
+
this.internalSetAttribute(attributeName, value);
|
|
11428
11418
|
|
|
11429
|
-
_Element.prototype.setAttribute.call(this, attributeName,
|
|
11419
|
+
_Element.prototype.setAttribute.call(this, attributeName, value);
|
|
11430
11420
|
}
|
|
11431
11421
|
}
|
|
11432
11422
|
/**
|
|
@@ -11456,7 +11446,13 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11456
11446
|
mutationEvent.attrName = name;
|
|
11457
11447
|
mutationEvent.prevParsedValue = oldParsedValue;
|
|
11458
11448
|
mutationEvent.newParsedValue = newParsedValue;
|
|
11459
|
-
|
|
11449
|
+
|
|
11450
|
+
if (this.isMutationObserved) {
|
|
11451
|
+
this.dispatchEvent(mutationEvent);
|
|
11452
|
+
} else {
|
|
11453
|
+
mutationEvent.target = this;
|
|
11454
|
+
this.ownerDocument.defaultView.dispatchEvent(mutationEvent, true);
|
|
11455
|
+
}
|
|
11460
11456
|
}
|
|
11461
11457
|
|
|
11462
11458
|
if ((this.isCustomElement && this.isConnected || !this.isCustomElement) && this.attributeChangedCallback) {
|
|
@@ -12513,7 +12509,11 @@ var Line = /*#__PURE__*/function (_DisplayObject) {
|
|
|
12513
12509
|
marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
|
|
12514
12510
|
};
|
|
12515
12511
|
|
|
12516
|
-
_proto.getPoint = function getPoint(ratio) {
|
|
12512
|
+
_proto.getPoint = function getPoint(ratio, inWorldSpace) {
|
|
12513
|
+
if (inWorldSpace === void 0) {
|
|
12514
|
+
inWorldSpace = false;
|
|
12515
|
+
}
|
|
12516
|
+
|
|
12517
12517
|
// TODO: account for z1/z2 in 3D line
|
|
12518
12518
|
var _this$parsedStyle3 = this.parsedStyle,
|
|
12519
12519
|
x1 = _this$parsedStyle3.x1,
|
|
@@ -12527,13 +12527,17 @@ var Line = /*#__PURE__*/function (_DisplayObject) {
|
|
|
12527
12527
|
x = _LineUtil$pointAt.x,
|
|
12528
12528
|
y = _LineUtil$pointAt.y;
|
|
12529
12529
|
|
|
12530
|
-
var transformed = vec3.transformMat4(vec3.create(), vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
|
|
12530
|
+
var transformed = vec3.transformMat4(vec3.create(), vec3.fromValues(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform()); // apply local transformation
|
|
12531
12531
|
|
|
12532
12532
|
return new Point(transformed[0], transformed[1]);
|
|
12533
12533
|
};
|
|
12534
12534
|
|
|
12535
|
-
_proto.getPointAtLength = function getPointAtLength(distance) {
|
|
12536
|
-
|
|
12535
|
+
_proto.getPointAtLength = function getPointAtLength(distance, inWorldSpace) {
|
|
12536
|
+
if (inWorldSpace === void 0) {
|
|
12537
|
+
inWorldSpace = false;
|
|
12538
|
+
}
|
|
12539
|
+
|
|
12540
|
+
return this.getPoint(distance / this.getTotalLength(), inWorldSpace);
|
|
12537
12541
|
};
|
|
12538
12542
|
|
|
12539
12543
|
_proto.getTotalLength = function getTotalLength() {
|
|
@@ -12730,7 +12734,11 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
|
|
|
12730
12734
|
*/
|
|
12731
12735
|
;
|
|
12732
12736
|
|
|
12733
|
-
_proto.getPointAtLength = function getPointAtLength$1(distance) {
|
|
12737
|
+
_proto.getPointAtLength = function getPointAtLength$1(distance, inWorldSpace) {
|
|
12738
|
+
if (inWorldSpace === void 0) {
|
|
12739
|
+
inWorldSpace = false;
|
|
12740
|
+
}
|
|
12741
|
+
|
|
12734
12742
|
var _this$parsedStyle4 = this.parsedStyle,
|
|
12735
12743
|
defX = _this$parsedStyle4.defX,
|
|
12736
12744
|
defY = _this$parsedStyle4.defY,
|
|
@@ -12740,7 +12748,7 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
|
|
|
12740
12748
|
x = _getPointAtLength2.x,
|
|
12741
12749
|
y = _getPointAtLength2.y;
|
|
12742
12750
|
|
|
12743
|
-
var transformed = vec3.transformMat4(vec3.create(), vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
|
|
12751
|
+
var transformed = vec3.transformMat4(vec3.create(), vec3.fromValues(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform()); // apply local transformation
|
|
12744
12752
|
|
|
12745
12753
|
return new Point(transformed[0], transformed[1]);
|
|
12746
12754
|
}
|
|
@@ -12749,8 +12757,12 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
|
|
|
12749
12757
|
*/
|
|
12750
12758
|
;
|
|
12751
12759
|
|
|
12752
|
-
_proto.getPoint = function getPoint(ratio) {
|
|
12753
|
-
|
|
12760
|
+
_proto.getPoint = function getPoint(ratio, inWorldSpace) {
|
|
12761
|
+
if (inWorldSpace === void 0) {
|
|
12762
|
+
inWorldSpace = false;
|
|
12763
|
+
}
|
|
12764
|
+
|
|
12765
|
+
return this.getPointAtLength(ratio * getOrCalculatePathTotalLength(this), inWorldSpace);
|
|
12754
12766
|
}
|
|
12755
12767
|
/**
|
|
12756
12768
|
* Get start tangent vector
|
|
@@ -13009,11 +13021,19 @@ var Polyline = /*#__PURE__*/function (_Polygon) {
|
|
|
13009
13021
|
return this.parsedStyle.points.totalLength;
|
|
13010
13022
|
};
|
|
13011
13023
|
|
|
13012
|
-
_proto.getPointAtLength = function getPointAtLength(distance) {
|
|
13013
|
-
|
|
13024
|
+
_proto.getPointAtLength = function getPointAtLength(distance, inWorldSpace) {
|
|
13025
|
+
if (inWorldSpace === void 0) {
|
|
13026
|
+
inWorldSpace = false;
|
|
13027
|
+
}
|
|
13028
|
+
|
|
13029
|
+
return this.getPoint(distance / this.getTotalLength(), inWorldSpace);
|
|
13014
13030
|
};
|
|
13015
13031
|
|
|
13016
|
-
_proto.getPoint = function getPoint(ratio) {
|
|
13032
|
+
_proto.getPoint = function getPoint(ratio, inWorldSpace) {
|
|
13033
|
+
if (inWorldSpace === void 0) {
|
|
13034
|
+
inWorldSpace = false;
|
|
13035
|
+
}
|
|
13036
|
+
|
|
13017
13037
|
var _this$parsedStyle = this.parsedStyle,
|
|
13018
13038
|
defX = _this$parsedStyle.defX,
|
|
13019
13039
|
defY = _this$parsedStyle.defY,
|
|
@@ -13033,7 +13053,7 @@ var Polyline = /*#__PURE__*/function (_Polygon) {
|
|
|
13033
13053
|
x = _LineUtil$pointAt.x,
|
|
13034
13054
|
y = _LineUtil$pointAt.y;
|
|
13035
13055
|
|
|
13036
|
-
var transformed = vec3.transformMat4(vec3.create(), vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
|
|
13056
|
+
var transformed = vec3.transformMat4(vec3.create(), vec3.fromValues(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform()); // apply local transformation
|
|
13037
13057
|
|
|
13038
13058
|
return new Point(transformed[0], transformed[1]);
|
|
13039
13059
|
};
|
|
@@ -14230,7 +14250,7 @@ var TextUpdater = /*#__PURE__*/function () {
|
|
|
14230
14250
|
var anchor = [0, 1];
|
|
14231
14251
|
var lineXOffset = 0;
|
|
14232
14252
|
|
|
14233
|
-
if (textAlign === 'center') {
|
|
14253
|
+
if (textAlign === 'center' || textAlign === 'middle') {
|
|
14234
14254
|
lineXOffset = lineWidth / 2;
|
|
14235
14255
|
anchor = [0.5, 1];
|
|
14236
14256
|
} else if (textAlign === 'right' || textAlign === 'end') {
|
|
@@ -14955,10 +14975,20 @@ var EventService = /*#__PURE__*/function () {
|
|
|
14955
14975
|
}
|
|
14956
14976
|
};
|
|
14957
14977
|
|
|
14958
|
-
_proto.dispatchEvent = function dispatchEvent(e, type) {
|
|
14959
|
-
|
|
14960
|
-
|
|
14961
|
-
|
|
14978
|
+
_proto.dispatchEvent = function dispatchEvent(e, type, skipPropagate) {
|
|
14979
|
+
// Canvas should skip
|
|
14980
|
+
if (!skipPropagate) {
|
|
14981
|
+
e.propagationStopped = false;
|
|
14982
|
+
e.propagationImmediatelyStopped = false;
|
|
14983
|
+
this.propagate(e, type);
|
|
14984
|
+
} else {
|
|
14985
|
+
// target phase
|
|
14986
|
+
e.eventPhase = e.AT_TARGET;
|
|
14987
|
+
var canvas = this.rootTarget.defaultView || null;
|
|
14988
|
+
e.currentTarget = canvas;
|
|
14989
|
+
this.notifyListeners(e, type);
|
|
14990
|
+
}
|
|
14991
|
+
|
|
14962
14992
|
this.emitter.emit(type || e.type, e);
|
|
14963
14993
|
};
|
|
14964
14994
|
|
|
@@ -15765,10 +15795,11 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
15765
15795
|
|
|
15766
15796
|
if (renderOrderChanged) {
|
|
15767
15797
|
displayObject.forEach(function (child) {
|
|
15798
|
+
_this2.renderOrderChangedEvent.target = child;
|
|
15768
15799
|
_this2.renderOrderChangedEvent.detail = {
|
|
15769
15800
|
renderOrder: child.sortable.renderOrder
|
|
15770
15801
|
};
|
|
15771
|
-
child.dispatchEvent(_this2.renderOrderChangedEvent);
|
|
15802
|
+
child.ownerDocument.defaultView.dispatchEvent(_this2.renderOrderChangedEvent, true);
|
|
15772
15803
|
});
|
|
15773
15804
|
}
|
|
15774
15805
|
};
|
|
@@ -16429,9 +16460,10 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
16429
16460
|
var set = new Set();
|
|
16430
16461
|
|
|
16431
16462
|
var trigger = function trigger(element, detail) {
|
|
16432
|
-
if (!set.has(element.entity)) {
|
|
16463
|
+
if (element.isConnected && !set.has(element.entity)) {
|
|
16433
16464
|
_this2.boundsChangedEvent.detail = detail;
|
|
16434
|
-
|
|
16465
|
+
_this2.boundsChangedEvent.target = element;
|
|
16466
|
+
element.ownerDocument.defaultView.dispatchEvent(_this2.boundsChangedEvent, true);
|
|
16435
16467
|
set.add(element.entity);
|
|
16436
16468
|
}
|
|
16437
16469
|
};
|
|
@@ -16449,6 +16481,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
16449
16481
|
}
|
|
16450
16482
|
});
|
|
16451
16483
|
this.pendingEvents = [];
|
|
16484
|
+
set.clear();
|
|
16452
16485
|
};
|
|
16453
16486
|
|
|
16454
16487
|
_proto.dirtifyToRoot = function dirtifyToRoot(element, affectChildren) {
|
|
@@ -17099,7 +17132,7 @@ var TextService = /*#__PURE__*/function () {
|
|
|
17099
17132
|
lineMetrics: lineWidths.map(function (width, i) {
|
|
17100
17133
|
var offsetX = 0; // handle horizontal text align
|
|
17101
17134
|
|
|
17102
|
-
if (textAlign === 'center') {
|
|
17135
|
+
if (textAlign === 'center' || textAlign === 'middle') {
|
|
17103
17136
|
offsetX -= width / 2;
|
|
17104
17137
|
} else if (textAlign === 'right' || textAlign === 'end') {
|
|
17105
17138
|
offsetX -= width;
|
|
@@ -17929,21 +17962,14 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
17929
17962
|
|
|
17930
17963
|
var _proto = PrepareRendererPlugin.prototype;
|
|
17931
17964
|
|
|
17932
|
-
|
|
17933
|
-
var _this = this;
|
|
17934
|
-
|
|
17935
|
-
list.forEach(function (i) {
|
|
17936
|
-
_this.toSync.add(i);
|
|
17937
|
-
});
|
|
17938
|
-
} // private isFirstTimeRendering = true;
|
|
17939
|
-
;
|
|
17940
|
-
|
|
17965
|
+
// private isFirstTimeRendering = true;
|
|
17941
17966
|
_proto.apply = function apply(context) {
|
|
17942
|
-
var
|
|
17967
|
+
var _this = this;
|
|
17943
17968
|
|
|
17944
17969
|
var renderingService = context.renderingService,
|
|
17945
17970
|
renderingContext = context.renderingContext,
|
|
17946
17971
|
rBushRoot = context.rBushRoot;
|
|
17972
|
+
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
17947
17973
|
this.rBush = rBushRoot;
|
|
17948
17974
|
|
|
17949
17975
|
var handleAttributeChanged = function handleAttributeChanged(e) {
|
|
@@ -17958,20 +17984,26 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
17958
17984
|
|
|
17959
17985
|
if (affectChildren) {
|
|
17960
17986
|
object.forEach(function (node) {
|
|
17961
|
-
|
|
17987
|
+
_this.toSync.add(node);
|
|
17962
17988
|
});
|
|
17963
17989
|
}
|
|
17964
17990
|
|
|
17965
|
-
|
|
17991
|
+
var p = object;
|
|
17992
|
+
|
|
17993
|
+
while (p) {
|
|
17994
|
+
if (p.renderable) {
|
|
17995
|
+
_this.toSync.add(p);
|
|
17996
|
+
}
|
|
17997
|
+
|
|
17998
|
+
p = p.parentElement;
|
|
17999
|
+
} // this.pushToSync(e.composedPath().slice(0, -2) as DisplayObject[]);
|
|
18000
|
+
|
|
17966
18001
|
|
|
17967
18002
|
renderingService.dirtify();
|
|
17968
18003
|
};
|
|
17969
18004
|
|
|
17970
18005
|
var handleMounted = function handleMounted(e) {
|
|
17971
|
-
var object = e.target;
|
|
17972
|
-
|
|
17973
|
-
_this2.pushToSync(e.composedPath().slice(0, -2)); // recalc style values
|
|
17974
|
-
|
|
18006
|
+
var object = e.target; // recalc style values
|
|
17975
18007
|
|
|
17976
18008
|
runtime.styleValueRegistry.recalc(object);
|
|
17977
18009
|
runtime.sceneGraphService.dirtifyToRoot(object);
|
|
@@ -17983,12 +18015,12 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
17983
18015
|
var rBushNode = object.rBushNode;
|
|
17984
18016
|
|
|
17985
18017
|
if (rBushNode.aabb) {
|
|
17986
|
-
|
|
18018
|
+
_this.rBush.remove(rBushNode.aabb);
|
|
17987
18019
|
}
|
|
17988
18020
|
|
|
17989
|
-
|
|
18021
|
+
_this.toSync.delete(object);
|
|
17990
18022
|
|
|
17991
|
-
runtime.sceneGraphService.dirtifyToRoot(
|
|
18023
|
+
runtime.sceneGraphService.dirtifyToRoot(object);
|
|
17992
18024
|
renderingService.dirtify();
|
|
17993
18025
|
};
|
|
17994
18026
|
|
|
@@ -17997,10 +18029,10 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
17997
18029
|
while (1) {
|
|
17998
18030
|
switch (_context.prev = _context.next) {
|
|
17999
18031
|
case 0:
|
|
18000
|
-
|
|
18001
|
-
|
|
18002
|
-
|
|
18003
|
-
|
|
18032
|
+
canvas.addEventListener(ElementEvent.MOUNTED, handleMounted);
|
|
18033
|
+
canvas.addEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
|
|
18034
|
+
canvas.addEventListener(ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
18035
|
+
canvas.addEventListener(ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
18004
18036
|
|
|
18005
18037
|
case 4:
|
|
18006
18038
|
case "end":
|
|
@@ -18010,10 +18042,10 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
18010
18042
|
}, _callee);
|
|
18011
18043
|
})));
|
|
18012
18044
|
renderingService.hooks.destroy.tap(PrepareRendererPlugin.tag, function () {
|
|
18013
|
-
|
|
18014
|
-
|
|
18015
|
-
|
|
18016
|
-
|
|
18045
|
+
canvas.removeEventListener(ElementEvent.MOUNTED, handleMounted);
|
|
18046
|
+
canvas.removeEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
|
|
18047
|
+
canvas.removeEventListener(ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
18048
|
+
canvas.removeEventListener(ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
18017
18049
|
});
|
|
18018
18050
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
18019
18051
|
// if (this.isFirstTimeRendering) {
|
|
@@ -18023,12 +18055,12 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
18023
18055
|
// } else {
|
|
18024
18056
|
// this.syncRTree();
|
|
18025
18057
|
// }
|
|
18026
|
-
|
|
18058
|
+
_this.syncRTree();
|
|
18027
18059
|
});
|
|
18028
18060
|
};
|
|
18029
18061
|
|
|
18030
18062
|
_proto.syncRTree = function syncRTree() {
|
|
18031
|
-
var
|
|
18063
|
+
var _this2 = this;
|
|
18032
18064
|
|
|
18033
18065
|
// bounds changed, need re-inserting its children
|
|
18034
18066
|
var bulk = [];
|
|
@@ -18039,7 +18071,7 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
18039
18071
|
var rBushNode = node.rBushNode; // clear dirty node
|
|
18040
18072
|
|
|
18041
18073
|
if (rBushNode && rBushNode.aabb) {
|
|
18042
|
-
|
|
18074
|
+
_this2.rBush.remove(rBushNode.aabb);
|
|
18043
18075
|
}
|
|
18044
18076
|
|
|
18045
18077
|
var renderBounds = node.getRenderBounds();
|
|
@@ -18102,8 +18134,8 @@ var DEFAULT_CAMERA_FAR = 1000;
|
|
|
18102
18134
|
* reuse custom event preventing from re-create them in every frame
|
|
18103
18135
|
*/
|
|
18104
18136
|
|
|
18105
|
-
var
|
|
18106
|
-
var
|
|
18137
|
+
var mountedEvent = new CustomEvent(ElementEvent.MOUNTED);
|
|
18138
|
+
var unmountedEvent = new CustomEvent(ElementEvent.UNMOUNTED);
|
|
18107
18139
|
var beforeRenderEvent = new CustomEvent(CanvasEvent.BEFORE_RENDER);
|
|
18108
18140
|
var afterRenderEvent = new CustomEvent(CanvasEvent.AFTER_RENDER);
|
|
18109
18141
|
/**
|
|
@@ -18618,13 +18650,20 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18618
18650
|
|
|
18619
18651
|
path.reverse().forEach(function (child) {
|
|
18620
18652
|
// trigger before unmounted
|
|
18621
|
-
if (child
|
|
18653
|
+
if (child.isCustomElement) {
|
|
18622
18654
|
if (child.disconnectedCallback) {
|
|
18623
18655
|
child.disconnectedCallback();
|
|
18624
18656
|
}
|
|
18625
18657
|
}
|
|
18626
18658
|
|
|
18627
|
-
child.
|
|
18659
|
+
if (child.isMutationObserved) {
|
|
18660
|
+
child.dispatchEvent(unmountedEvent);
|
|
18661
|
+
} else {
|
|
18662
|
+
unmountedEvent.target = child;
|
|
18663
|
+
|
|
18664
|
+
_this5.dispatchEvent(unmountedEvent, true);
|
|
18665
|
+
} // skip document.documentElement
|
|
18666
|
+
|
|
18628
18667
|
|
|
18629
18668
|
if (child !== _this5.document.documentElement) {
|
|
18630
18669
|
child.ownerDocument = null;
|
|
@@ -18643,9 +18682,17 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18643
18682
|
if (!child.isConnected) {
|
|
18644
18683
|
child.ownerDocument = _this6.document;
|
|
18645
18684
|
child.isConnected = true;
|
|
18646
|
-
child.dispatchEvent(mountEvent); // trigger after mounted
|
|
18647
18685
|
|
|
18648
|
-
if (child
|
|
18686
|
+
if (child.isMutationObserved) {
|
|
18687
|
+
child.dispatchEvent(mountedEvent);
|
|
18688
|
+
} else {
|
|
18689
|
+
mountedEvent.target = child;
|
|
18690
|
+
|
|
18691
|
+
_this6.dispatchEvent(mountedEvent, true);
|
|
18692
|
+
} // trigger after mounted
|
|
18693
|
+
|
|
18694
|
+
|
|
18695
|
+
if (child.isCustomElement) {
|
|
18649
18696
|
if (child.connectedCallback) {
|
|
18650
18697
|
child.connectedCallback();
|
|
18651
18698
|
}
|