@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.js
CHANGED
|
@@ -563,10 +563,7 @@ var FORMAT_ATTR_MAP = {
|
|
|
563
563
|
alias: 'lineWidth'
|
|
564
564
|
},
|
|
565
565
|
textAnchor: {
|
|
566
|
-
alias: 'textAlign'
|
|
567
|
-
values: {
|
|
568
|
-
middle: 'center'
|
|
569
|
-
}
|
|
566
|
+
alias: 'textAlign'
|
|
570
567
|
},
|
|
571
568
|
src: {
|
|
572
569
|
alias: 'img'
|
|
@@ -576,18 +573,8 @@ var formatAttributeName = util.memoize(function (name) {
|
|
|
576
573
|
var attributeName = camelCase(name);
|
|
577
574
|
var map = FORMAT_ATTR_MAP[attributeName];
|
|
578
575
|
attributeName = (map === null || map === void 0 ? void 0 : map.alias) || attributeName;
|
|
579
|
-
return
|
|
576
|
+
return attributeName;
|
|
580
577
|
});
|
|
581
|
-
function formatAttribute(name, value) {
|
|
582
|
-
var _map$values;
|
|
583
|
-
|
|
584
|
-
var _formatAttributeName = formatAttributeName(name),
|
|
585
|
-
attributeName = _formatAttributeName[0],
|
|
586
|
-
map = _formatAttributeName[1];
|
|
587
|
-
|
|
588
|
-
var attributeValue = util.isString(value) && (map === null || map === void 0 ? void 0 : (_map$values = map.values) === null || _map$values === void 0 ? void 0 : _map$values[value]) || value;
|
|
589
|
-
return [attributeName, attributeValue];
|
|
590
|
-
}
|
|
591
578
|
|
|
592
579
|
var canvasMap = {};
|
|
593
580
|
var defaultCanvasIdCounter = 0;
|
|
@@ -5443,16 +5430,23 @@ var CSSPropertyOffsetDistance = /*#__PURE__*/function () {
|
|
|
5443
5430
|
};
|
|
5444
5431
|
|
|
5445
5432
|
_proto.postProcessor = function postProcessor(object) {
|
|
5446
|
-
|
|
5433
|
+
var _object$parsedStyle = object.parsedStyle,
|
|
5434
|
+
offsetPath = _object$parsedStyle.offsetPath,
|
|
5435
|
+
offsetDistance = _object$parsedStyle.offsetDistance;
|
|
5436
|
+
|
|
5437
|
+
if (!offsetPath) {
|
|
5447
5438
|
return;
|
|
5448
5439
|
}
|
|
5449
5440
|
|
|
5450
|
-
var
|
|
5441
|
+
var nodeName = offsetPath.nodeName;
|
|
5451
5442
|
|
|
5452
|
-
if (
|
|
5453
|
-
|
|
5443
|
+
if (nodeName === exports.Shape.LINE || nodeName === exports.Shape.PATH || nodeName === exports.Shape.POLYLINE) {
|
|
5444
|
+
// set position in world space
|
|
5445
|
+
var point = offsetPath.getPoint(offsetDistance);
|
|
5454
5446
|
|
|
5455
5447
|
if (point) {
|
|
5448
|
+
object.parsedStyle.defX = point.x;
|
|
5449
|
+
object.parsedStyle.defY = point.y;
|
|
5456
5450
|
object.setLocalPosition(point.x, point.y);
|
|
5457
5451
|
}
|
|
5458
5452
|
}
|
|
@@ -8558,7 +8552,7 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
8558
8552
|
n: 'textAlign',
|
|
8559
8553
|
l: true,
|
|
8560
8554
|
inh: true,
|
|
8561
|
-
k: ['start', 'center', 'end', 'left', 'right'],
|
|
8555
|
+
k: ['start', 'center', 'middle', 'end', 'left', 'right'],
|
|
8562
8556
|
d: 'start'
|
|
8563
8557
|
}, // {
|
|
8564
8558
|
// n: 'whiteSpace',
|
|
@@ -8670,12 +8664,10 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
8670
8664
|
attributeNames.forEach(function (attributeName) {
|
|
8671
8665
|
var _propertyMetadataCach;
|
|
8672
8666
|
|
|
8673
|
-
var
|
|
8674
|
-
name = _formatAttribute[0],
|
|
8675
|
-
value = _formatAttribute[1];
|
|
8667
|
+
var name = formatAttributeName(attributeName);
|
|
8676
8668
|
|
|
8677
8669
|
if (!skipUpdateAttribute) {
|
|
8678
|
-
object.attributes[name] =
|
|
8670
|
+
object.attributes[name] = attributes[attributeName];
|
|
8679
8671
|
}
|
|
8680
8672
|
|
|
8681
8673
|
if (!needUpdateGeometry && ((_propertyMetadataCach = propertyMetadataCache[name]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.l)) {
|
|
@@ -9459,7 +9451,11 @@ var EventTarget = /*#__PURE__*/function () {
|
|
|
9459
9451
|
*/
|
|
9460
9452
|
;
|
|
9461
9453
|
|
|
9462
|
-
_proto.dispatchEvent = function dispatchEvent(e) {
|
|
9454
|
+
_proto.dispatchEvent = function dispatchEvent(e, skipPropagate) {
|
|
9455
|
+
if (skipPropagate === void 0) {
|
|
9456
|
+
skipPropagate = false;
|
|
9457
|
+
}
|
|
9458
|
+
|
|
9463
9459
|
if (!(e instanceof FederatedEvent)) {
|
|
9464
9460
|
throw new Error('DisplayObject cannot propagate events outside of the Federated Events API');
|
|
9465
9461
|
} // should account for Element / Document / Canvas
|
|
@@ -9489,8 +9485,12 @@ var EventTarget = /*#__PURE__*/function () {
|
|
|
9489
9485
|
|
|
9490
9486
|
e.defaultPrevented = false;
|
|
9491
9487
|
e.path = [];
|
|
9492
|
-
|
|
9493
|
-
(
|
|
9488
|
+
|
|
9489
|
+
if (!skipPropagate) {
|
|
9490
|
+
e.target = this;
|
|
9491
|
+
}
|
|
9492
|
+
|
|
9493
|
+
(_e$manager = e.manager) === null || _e$manager === void 0 ? void 0 : _e$manager.dispatchEvent(e, e.type, skipPropagate);
|
|
9494
9494
|
}
|
|
9495
9495
|
|
|
9496
9496
|
return !e.defaultPrevented;
|
|
@@ -10808,9 +10808,7 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
10808
10808
|
var value = this.attributes[name];
|
|
10809
10809
|
|
|
10810
10810
|
if (value === undefined) {
|
|
10811
|
-
var
|
|
10812
|
-
attributeName = _formatAttribute[0];
|
|
10813
|
-
|
|
10811
|
+
var attributeName = formatAttributeName(name);
|
|
10814
10812
|
value = this.attributes[attributeName]; // if the given attribute does not exist, the value returned will either be null or ""
|
|
10815
10813
|
|
|
10816
10814
|
return util.isNil(value) ? null : value;
|
|
@@ -11219,6 +11217,7 @@ var DEFAULT_PARSED_STYLE_PROPS = {
|
|
|
11219
11217
|
filter: [],
|
|
11220
11218
|
shadowType: 'outer'
|
|
11221
11219
|
};
|
|
11220
|
+
var INHERITABLE_STYLE_PROPS = ['opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform'];
|
|
11222
11221
|
/**
|
|
11223
11222
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
11224
11223
|
*
|
|
@@ -11258,6 +11257,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11258
11257
|
|
|
11259
11258
|
_this.config = void 0;
|
|
11260
11259
|
_this.isCustomElement = false;
|
|
11260
|
+
_this.isMutationObserved = false;
|
|
11261
11261
|
_this.activeAnimations = [];
|
|
11262
11262
|
|
|
11263
11263
|
_this.getClip = function () {
|
|
@@ -11392,14 +11392,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11392
11392
|
|
|
11393
11393
|
runtime.styleValueRegistry.processProperties(this, attributes, {
|
|
11394
11394
|
forceUpdateGeometry: true,
|
|
11395
|
-
usedAttributes:
|
|
11396
|
-
// 'transform',
|
|
11397
|
-
// 'zIndex',
|
|
11398
|
-
// 'filter',
|
|
11399
|
-
// 'shadowType',
|
|
11400
|
-
// 'fill',
|
|
11401
|
-
// 'stroke',
|
|
11402
|
-
'opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform']
|
|
11395
|
+
usedAttributes: INHERITABLE_STYLE_PROPS
|
|
11403
11396
|
}); // redraw at next frame
|
|
11404
11397
|
|
|
11405
11398
|
renderable.dirty = true;
|
|
@@ -11410,19 +11403,16 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11410
11403
|
force = false;
|
|
11411
11404
|
}
|
|
11412
11405
|
|
|
11413
|
-
var
|
|
11414
|
-
attributeName = _formatAttribute[0],
|
|
11415
|
-
attributeValue = _formatAttribute[1]; // ignore undefined value
|
|
11416
|
-
|
|
11406
|
+
var attributeName = formatAttributeName(name); // ignore undefined value
|
|
11417
11407
|
|
|
11418
11408
|
if (util.isUndefined(value)) {
|
|
11419
11409
|
return;
|
|
11420
11410
|
}
|
|
11421
11411
|
|
|
11422
|
-
if (force ||
|
|
11423
|
-
this.internalSetAttribute(attributeName,
|
|
11412
|
+
if (force || value !== this.attributes[attributeName]) {
|
|
11413
|
+
this.internalSetAttribute(attributeName, value);
|
|
11424
11414
|
|
|
11425
|
-
_Element.prototype.setAttribute.call(this, attributeName,
|
|
11415
|
+
_Element.prototype.setAttribute.call(this, attributeName, value);
|
|
11426
11416
|
}
|
|
11427
11417
|
}
|
|
11428
11418
|
/**
|
|
@@ -11452,7 +11442,13 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11452
11442
|
mutationEvent.attrName = name;
|
|
11453
11443
|
mutationEvent.prevParsedValue = oldParsedValue;
|
|
11454
11444
|
mutationEvent.newParsedValue = newParsedValue;
|
|
11455
|
-
|
|
11445
|
+
|
|
11446
|
+
if (this.isMutationObserved) {
|
|
11447
|
+
this.dispatchEvent(mutationEvent);
|
|
11448
|
+
} else {
|
|
11449
|
+
mutationEvent.target = this;
|
|
11450
|
+
this.ownerDocument.defaultView.dispatchEvent(mutationEvent, true);
|
|
11451
|
+
}
|
|
11456
11452
|
}
|
|
11457
11453
|
|
|
11458
11454
|
if ((this.isCustomElement && this.isConnected || !this.isCustomElement) && this.attributeChangedCallback) {
|
|
@@ -12509,7 +12505,11 @@ var Line = /*#__PURE__*/function (_DisplayObject) {
|
|
|
12509
12505
|
marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
|
|
12510
12506
|
};
|
|
12511
12507
|
|
|
12512
|
-
_proto.getPoint = function getPoint(ratio) {
|
|
12508
|
+
_proto.getPoint = function getPoint(ratio, inWorldSpace) {
|
|
12509
|
+
if (inWorldSpace === void 0) {
|
|
12510
|
+
inWorldSpace = false;
|
|
12511
|
+
}
|
|
12512
|
+
|
|
12513
12513
|
// TODO: account for z1/z2 in 3D line
|
|
12514
12514
|
var _this$parsedStyle3 = this.parsedStyle,
|
|
12515
12515
|
x1 = _this$parsedStyle3.x1,
|
|
@@ -12523,13 +12523,17 @@ var Line = /*#__PURE__*/function (_DisplayObject) {
|
|
|
12523
12523
|
x = _LineUtil$pointAt.x,
|
|
12524
12524
|
y = _LineUtil$pointAt.y;
|
|
12525
12525
|
|
|
12526
|
-
var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
|
|
12526
|
+
var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform()); // apply local transformation
|
|
12527
12527
|
|
|
12528
12528
|
return new Point(transformed[0], transformed[1]);
|
|
12529
12529
|
};
|
|
12530
12530
|
|
|
12531
|
-
_proto.getPointAtLength = function getPointAtLength(distance) {
|
|
12532
|
-
|
|
12531
|
+
_proto.getPointAtLength = function getPointAtLength(distance, inWorldSpace) {
|
|
12532
|
+
if (inWorldSpace === void 0) {
|
|
12533
|
+
inWorldSpace = false;
|
|
12534
|
+
}
|
|
12535
|
+
|
|
12536
|
+
return this.getPoint(distance / this.getTotalLength(), inWorldSpace);
|
|
12533
12537
|
};
|
|
12534
12538
|
|
|
12535
12539
|
_proto.getTotalLength = function getTotalLength() {
|
|
@@ -12726,7 +12730,11 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
|
|
|
12726
12730
|
*/
|
|
12727
12731
|
;
|
|
12728
12732
|
|
|
12729
|
-
_proto.getPointAtLength = function getPointAtLength(distance) {
|
|
12733
|
+
_proto.getPointAtLength = function getPointAtLength(distance, inWorldSpace) {
|
|
12734
|
+
if (inWorldSpace === void 0) {
|
|
12735
|
+
inWorldSpace = false;
|
|
12736
|
+
}
|
|
12737
|
+
|
|
12730
12738
|
var _this$parsedStyle4 = this.parsedStyle,
|
|
12731
12739
|
defX = _this$parsedStyle4.defX,
|
|
12732
12740
|
defY = _this$parsedStyle4.defY,
|
|
@@ -12736,7 +12744,7 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
|
|
|
12736
12744
|
x = _getPointAtLength2.x,
|
|
12737
12745
|
y = _getPointAtLength2.y;
|
|
12738
12746
|
|
|
12739
|
-
var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
|
|
12747
|
+
var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform()); // apply local transformation
|
|
12740
12748
|
|
|
12741
12749
|
return new Point(transformed[0], transformed[1]);
|
|
12742
12750
|
}
|
|
@@ -12745,8 +12753,12 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
|
|
|
12745
12753
|
*/
|
|
12746
12754
|
;
|
|
12747
12755
|
|
|
12748
|
-
_proto.getPoint = function getPoint(ratio) {
|
|
12749
|
-
|
|
12756
|
+
_proto.getPoint = function getPoint(ratio, inWorldSpace) {
|
|
12757
|
+
if (inWorldSpace === void 0) {
|
|
12758
|
+
inWorldSpace = false;
|
|
12759
|
+
}
|
|
12760
|
+
|
|
12761
|
+
return this.getPointAtLength(ratio * getOrCalculatePathTotalLength(this), inWorldSpace);
|
|
12750
12762
|
}
|
|
12751
12763
|
/**
|
|
12752
12764
|
* Get start tangent vector
|
|
@@ -13005,11 +13017,19 @@ var Polyline = /*#__PURE__*/function (_Polygon) {
|
|
|
13005
13017
|
return this.parsedStyle.points.totalLength;
|
|
13006
13018
|
};
|
|
13007
13019
|
|
|
13008
|
-
_proto.getPointAtLength = function getPointAtLength(distance) {
|
|
13009
|
-
|
|
13020
|
+
_proto.getPointAtLength = function getPointAtLength(distance, inWorldSpace) {
|
|
13021
|
+
if (inWorldSpace === void 0) {
|
|
13022
|
+
inWorldSpace = false;
|
|
13023
|
+
}
|
|
13024
|
+
|
|
13025
|
+
return this.getPoint(distance / this.getTotalLength(), inWorldSpace);
|
|
13010
13026
|
};
|
|
13011
13027
|
|
|
13012
|
-
_proto.getPoint = function getPoint(ratio) {
|
|
13028
|
+
_proto.getPoint = function getPoint(ratio, inWorldSpace) {
|
|
13029
|
+
if (inWorldSpace === void 0) {
|
|
13030
|
+
inWorldSpace = false;
|
|
13031
|
+
}
|
|
13032
|
+
|
|
13013
13033
|
var _this$parsedStyle = this.parsedStyle,
|
|
13014
13034
|
defX = _this$parsedStyle.defX,
|
|
13015
13035
|
defY = _this$parsedStyle.defY,
|
|
@@ -13029,7 +13049,7 @@ var Polyline = /*#__PURE__*/function (_Polygon) {
|
|
|
13029
13049
|
x = _LineUtil$pointAt.x,
|
|
13030
13050
|
y = _LineUtil$pointAt.y;
|
|
13031
13051
|
|
|
13032
|
-
var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
|
|
13052
|
+
var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform()); // apply local transformation
|
|
13033
13053
|
|
|
13034
13054
|
return new Point(transformed[0], transformed[1]);
|
|
13035
13055
|
};
|
|
@@ -14217,7 +14237,7 @@ var TextUpdater = /*#__PURE__*/function () {
|
|
|
14217
14237
|
var anchor = [0, 1];
|
|
14218
14238
|
var lineXOffset = 0;
|
|
14219
14239
|
|
|
14220
|
-
if (textAlign === 'center') {
|
|
14240
|
+
if (textAlign === 'center' || textAlign === 'middle') {
|
|
14221
14241
|
lineXOffset = lineWidth / 2;
|
|
14222
14242
|
anchor = [0.5, 1];
|
|
14223
14243
|
} else if (textAlign === 'right' || textAlign === 'end') {
|
|
@@ -14942,10 +14962,20 @@ var EventService = /*#__PURE__*/function () {
|
|
|
14942
14962
|
}
|
|
14943
14963
|
};
|
|
14944
14964
|
|
|
14945
|
-
_proto.dispatchEvent = function dispatchEvent(e, type) {
|
|
14946
|
-
|
|
14947
|
-
|
|
14948
|
-
|
|
14965
|
+
_proto.dispatchEvent = function dispatchEvent(e, type, skipPropagate) {
|
|
14966
|
+
// Canvas should skip
|
|
14967
|
+
if (!skipPropagate) {
|
|
14968
|
+
e.propagationStopped = false;
|
|
14969
|
+
e.propagationImmediatelyStopped = false;
|
|
14970
|
+
this.propagate(e, type);
|
|
14971
|
+
} else {
|
|
14972
|
+
// target phase
|
|
14973
|
+
e.eventPhase = e.AT_TARGET;
|
|
14974
|
+
var canvas = this.rootTarget.defaultView || null;
|
|
14975
|
+
e.currentTarget = canvas;
|
|
14976
|
+
this.notifyListeners(e, type);
|
|
14977
|
+
}
|
|
14978
|
+
|
|
14949
14979
|
this.emitter.emit(type || e.type, e);
|
|
14950
14980
|
};
|
|
14951
14981
|
|
|
@@ -15751,10 +15781,11 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
15751
15781
|
|
|
15752
15782
|
if (renderOrderChanged) {
|
|
15753
15783
|
displayObject.forEach(function (child) {
|
|
15784
|
+
_this2.renderOrderChangedEvent.target = child;
|
|
15754
15785
|
_this2.renderOrderChangedEvent.detail = {
|
|
15755
15786
|
renderOrder: child.sortable.renderOrder
|
|
15756
15787
|
};
|
|
15757
|
-
child.dispatchEvent(_this2.renderOrderChangedEvent);
|
|
15788
|
+
child.ownerDocument.defaultView.dispatchEvent(_this2.renderOrderChangedEvent, true);
|
|
15758
15789
|
});
|
|
15759
15790
|
}
|
|
15760
15791
|
};
|
|
@@ -16415,9 +16446,10 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
16415
16446
|
var set = new Set();
|
|
16416
16447
|
|
|
16417
16448
|
var trigger = function trigger(element, detail) {
|
|
16418
|
-
if (!set.has(element.entity)) {
|
|
16449
|
+
if (element.isConnected && !set.has(element.entity)) {
|
|
16419
16450
|
_this2.boundsChangedEvent.detail = detail;
|
|
16420
|
-
|
|
16451
|
+
_this2.boundsChangedEvent.target = element;
|
|
16452
|
+
element.ownerDocument.defaultView.dispatchEvent(_this2.boundsChangedEvent, true);
|
|
16421
16453
|
set.add(element.entity);
|
|
16422
16454
|
}
|
|
16423
16455
|
};
|
|
@@ -16435,6 +16467,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
16435
16467
|
}
|
|
16436
16468
|
});
|
|
16437
16469
|
this.pendingEvents = [];
|
|
16470
|
+
set.clear();
|
|
16438
16471
|
};
|
|
16439
16472
|
|
|
16440
16473
|
_proto.dirtifyToRoot = function dirtifyToRoot(element, affectChildren) {
|
|
@@ -17085,7 +17118,7 @@ var TextService = /*#__PURE__*/function () {
|
|
|
17085
17118
|
lineMetrics: lineWidths.map(function (width, i) {
|
|
17086
17119
|
var offsetX = 0; // handle horizontal text align
|
|
17087
17120
|
|
|
17088
|
-
if (textAlign === 'center') {
|
|
17121
|
+
if (textAlign === 'center' || textAlign === 'middle') {
|
|
17089
17122
|
offsetX -= width / 2;
|
|
17090
17123
|
} else if (textAlign === 'right' || textAlign === 'end') {
|
|
17091
17124
|
offsetX -= width;
|
|
@@ -17915,21 +17948,14 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
17915
17948
|
|
|
17916
17949
|
var _proto = PrepareRendererPlugin.prototype;
|
|
17917
17950
|
|
|
17918
|
-
|
|
17919
|
-
var _this = this;
|
|
17920
|
-
|
|
17921
|
-
list.forEach(function (i) {
|
|
17922
|
-
_this.toSync.add(i);
|
|
17923
|
-
});
|
|
17924
|
-
} // private isFirstTimeRendering = true;
|
|
17925
|
-
;
|
|
17926
|
-
|
|
17951
|
+
// private isFirstTimeRendering = true;
|
|
17927
17952
|
_proto.apply = function apply(context) {
|
|
17928
|
-
var
|
|
17953
|
+
var _this = this;
|
|
17929
17954
|
|
|
17930
17955
|
var renderingService = context.renderingService,
|
|
17931
17956
|
renderingContext = context.renderingContext,
|
|
17932
17957
|
rBushRoot = context.rBushRoot;
|
|
17958
|
+
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
17933
17959
|
this.rBush = rBushRoot;
|
|
17934
17960
|
|
|
17935
17961
|
var handleAttributeChanged = function handleAttributeChanged(e) {
|
|
@@ -17944,20 +17970,26 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
17944
17970
|
|
|
17945
17971
|
if (affectChildren) {
|
|
17946
17972
|
object.forEach(function (node) {
|
|
17947
|
-
|
|
17973
|
+
_this.toSync.add(node);
|
|
17948
17974
|
});
|
|
17949
17975
|
}
|
|
17950
17976
|
|
|
17951
|
-
|
|
17977
|
+
var p = object;
|
|
17978
|
+
|
|
17979
|
+
while (p) {
|
|
17980
|
+
if (p.renderable) {
|
|
17981
|
+
_this.toSync.add(p);
|
|
17982
|
+
}
|
|
17983
|
+
|
|
17984
|
+
p = p.parentElement;
|
|
17985
|
+
} // this.pushToSync(e.composedPath().slice(0, -2) as DisplayObject[]);
|
|
17986
|
+
|
|
17952
17987
|
|
|
17953
17988
|
renderingService.dirtify();
|
|
17954
17989
|
};
|
|
17955
17990
|
|
|
17956
17991
|
var handleMounted = function handleMounted(e) {
|
|
17957
|
-
var object = e.target;
|
|
17958
|
-
|
|
17959
|
-
_this2.pushToSync(e.composedPath().slice(0, -2)); // recalc style values
|
|
17960
|
-
|
|
17992
|
+
var object = e.target; // recalc style values
|
|
17961
17993
|
|
|
17962
17994
|
runtime.styleValueRegistry.recalc(object);
|
|
17963
17995
|
runtime.sceneGraphService.dirtifyToRoot(object);
|
|
@@ -17969,12 +18001,12 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
17969
18001
|
var rBushNode = object.rBushNode;
|
|
17970
18002
|
|
|
17971
18003
|
if (rBushNode.aabb) {
|
|
17972
|
-
|
|
18004
|
+
_this.rBush.remove(rBushNode.aabb);
|
|
17973
18005
|
}
|
|
17974
18006
|
|
|
17975
|
-
|
|
18007
|
+
_this.toSync.delete(object);
|
|
17976
18008
|
|
|
17977
|
-
runtime.sceneGraphService.dirtifyToRoot(
|
|
18009
|
+
runtime.sceneGraphService.dirtifyToRoot(object);
|
|
17978
18010
|
renderingService.dirtify();
|
|
17979
18011
|
};
|
|
17980
18012
|
|
|
@@ -17983,10 +18015,10 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
17983
18015
|
while (1) {
|
|
17984
18016
|
switch (_context.prev = _context.next) {
|
|
17985
18017
|
case 0:
|
|
17986
|
-
|
|
17987
|
-
|
|
17988
|
-
|
|
17989
|
-
|
|
18018
|
+
canvas.addEventListener(exports.ElementEvent.MOUNTED, handleMounted);
|
|
18019
|
+
canvas.addEventListener(exports.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
18020
|
+
canvas.addEventListener(exports.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
18021
|
+
canvas.addEventListener(exports.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
17990
18022
|
|
|
17991
18023
|
case 4:
|
|
17992
18024
|
case "end":
|
|
@@ -17996,10 +18028,10 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
17996
18028
|
}, _callee);
|
|
17997
18029
|
})));
|
|
17998
18030
|
renderingService.hooks.destroy.tap(PrepareRendererPlugin.tag, function () {
|
|
17999
|
-
|
|
18000
|
-
|
|
18001
|
-
|
|
18002
|
-
|
|
18031
|
+
canvas.removeEventListener(exports.ElementEvent.MOUNTED, handleMounted);
|
|
18032
|
+
canvas.removeEventListener(exports.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
18033
|
+
canvas.removeEventListener(exports.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
18034
|
+
canvas.removeEventListener(exports.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
18003
18035
|
});
|
|
18004
18036
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
18005
18037
|
// if (this.isFirstTimeRendering) {
|
|
@@ -18009,12 +18041,12 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
18009
18041
|
// } else {
|
|
18010
18042
|
// this.syncRTree();
|
|
18011
18043
|
// }
|
|
18012
|
-
|
|
18044
|
+
_this.syncRTree();
|
|
18013
18045
|
});
|
|
18014
18046
|
};
|
|
18015
18047
|
|
|
18016
18048
|
_proto.syncRTree = function syncRTree() {
|
|
18017
|
-
var
|
|
18049
|
+
var _this2 = this;
|
|
18018
18050
|
|
|
18019
18051
|
// bounds changed, need re-inserting its children
|
|
18020
18052
|
var bulk = [];
|
|
@@ -18025,7 +18057,7 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
18025
18057
|
var rBushNode = node.rBushNode; // clear dirty node
|
|
18026
18058
|
|
|
18027
18059
|
if (rBushNode && rBushNode.aabb) {
|
|
18028
|
-
|
|
18060
|
+
_this2.rBush.remove(rBushNode.aabb);
|
|
18029
18061
|
}
|
|
18030
18062
|
|
|
18031
18063
|
var renderBounds = node.getRenderBounds();
|
|
@@ -18086,8 +18118,8 @@ var DEFAULT_CAMERA_FAR = 1000;
|
|
|
18086
18118
|
* reuse custom event preventing from re-create them in every frame
|
|
18087
18119
|
*/
|
|
18088
18120
|
|
|
18089
|
-
var
|
|
18090
|
-
var
|
|
18121
|
+
var mountedEvent = new CustomEvent(exports.ElementEvent.MOUNTED);
|
|
18122
|
+
var unmountedEvent = new CustomEvent(exports.ElementEvent.UNMOUNTED);
|
|
18091
18123
|
var beforeRenderEvent = new CustomEvent(exports.CanvasEvent.BEFORE_RENDER);
|
|
18092
18124
|
var afterRenderEvent = new CustomEvent(exports.CanvasEvent.AFTER_RENDER);
|
|
18093
18125
|
/**
|
|
@@ -18602,13 +18634,20 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18602
18634
|
|
|
18603
18635
|
path.reverse().forEach(function (child) {
|
|
18604
18636
|
// trigger before unmounted
|
|
18605
|
-
if (child
|
|
18637
|
+
if (child.isCustomElement) {
|
|
18606
18638
|
if (child.disconnectedCallback) {
|
|
18607
18639
|
child.disconnectedCallback();
|
|
18608
18640
|
}
|
|
18609
18641
|
}
|
|
18610
18642
|
|
|
18611
|
-
child.
|
|
18643
|
+
if (child.isMutationObserved) {
|
|
18644
|
+
child.dispatchEvent(unmountedEvent);
|
|
18645
|
+
} else {
|
|
18646
|
+
unmountedEvent.target = child;
|
|
18647
|
+
|
|
18648
|
+
_this5.dispatchEvent(unmountedEvent, true);
|
|
18649
|
+
} // skip document.documentElement
|
|
18650
|
+
|
|
18612
18651
|
|
|
18613
18652
|
if (child !== _this5.document.documentElement) {
|
|
18614
18653
|
child.ownerDocument = null;
|
|
@@ -18627,9 +18666,17 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18627
18666
|
if (!child.isConnected) {
|
|
18628
18667
|
child.ownerDocument = _this6.document;
|
|
18629
18668
|
child.isConnected = true;
|
|
18630
|
-
child.dispatchEvent(mountEvent); // trigger after mounted
|
|
18631
18669
|
|
|
18632
|
-
if (child
|
|
18670
|
+
if (child.isMutationObserved) {
|
|
18671
|
+
child.dispatchEvent(mountedEvent);
|
|
18672
|
+
} else {
|
|
18673
|
+
mountedEvent.target = child;
|
|
18674
|
+
|
|
18675
|
+
_this6.dispatchEvent(mountedEvent, true);
|
|
18676
|
+
} // trigger after mounted
|
|
18677
|
+
|
|
18678
|
+
|
|
18679
|
+
if (child.isCustomElement) {
|
|
18633
18680
|
if (child.connectedCallback) {
|
|
18634
18681
|
child.connectedCallback();
|
|
18635
18682
|
}
|