@antv/g-lite 1.0.11 → 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/README.md +1 -1
- package/dist/Canvas.d.ts +2 -9
- package/dist/Canvas.d.ts.map +1 -1
- package/dist/camera/Camera.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 +70 -1
- package/dist/display-objects/DisplayObject.d.ts.map +1 -1
- package/dist/display-objects/DisplayObjectPool.d.ts +2 -2
- package/dist/display-objects/DisplayObjectPool.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/Element.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 +3 -9
- package/dist/dom/interfaces.d.ts.map +1 -1
- package/dist/index.esm.js +376 -225
- package/dist/index.js +376 -225
- package/dist/index.umd.js +381 -232
- 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/shapes/AABB.d.ts +1 -1
- package/dist/shapes/AABB.d.ts.map +1 -1
- package/dist/utils/assert.d.ts +4 -1
- package/dist/utils/assert.d.ts.map +1 -1
- package/dist/utils/text.d.ts.map +1 -1
- package/package.json +6 -3
package/dist/index.umd.js
CHANGED
|
@@ -5376,16 +5376,11 @@
|
|
|
5376
5376
|
return result[0].length === result[1].length ? result : equalizeSegments(result[0], result[1], tl);
|
|
5377
5377
|
}
|
|
5378
5378
|
|
|
5379
|
-
var toString = {}.toString;
|
|
5380
|
-
var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
|
|
5381
|
-
|
|
5382
5379
|
/**
|
|
5383
|
-
*
|
|
5384
|
-
* @param {*} fn 对象
|
|
5385
|
-
* @return {Boolean} 是否函数
|
|
5380
|
+
* @see https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_isfunction
|
|
5386
5381
|
*/
|
|
5387
5382
|
var isFunction = (function (value) {
|
|
5388
|
-
return
|
|
5383
|
+
return typeof value === 'function';
|
|
5389
5384
|
});
|
|
5390
5385
|
|
|
5391
5386
|
// isFinite,
|
|
@@ -5397,6 +5392,9 @@
|
|
|
5397
5392
|
return value === null || value === undefined;
|
|
5398
5393
|
};
|
|
5399
5394
|
|
|
5395
|
+
var toString = {}.toString;
|
|
5396
|
+
var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
|
|
5397
|
+
|
|
5400
5398
|
var isObject = (function (value) {
|
|
5401
5399
|
/**
|
|
5402
5400
|
* isObject({}) => true
|
|
@@ -5486,6 +5484,14 @@
|
|
|
5486
5484
|
};
|
|
5487
5485
|
|
|
5488
5486
|
function AABB(center, halfExtents) {
|
|
5487
|
+
if (center === void 0) {
|
|
5488
|
+
center = [0, 0, 0];
|
|
5489
|
+
}
|
|
5490
|
+
|
|
5491
|
+
if (halfExtents === void 0) {
|
|
5492
|
+
halfExtents = [0, 0, 0];
|
|
5493
|
+
}
|
|
5494
|
+
|
|
5489
5495
|
this.center = create$2();
|
|
5490
5496
|
this.halfExtents = create$2();
|
|
5491
5497
|
this.min = create$2();
|
|
@@ -5496,16 +5502,10 @@
|
|
|
5496
5502
|
var _proto = AABB.prototype;
|
|
5497
5503
|
|
|
5498
5504
|
_proto.update = function update(center, halfExtents) {
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
if (halfExtents) {
|
|
5504
|
-
copy$1(this.halfExtents, halfExtents || fromValues$2(0, 0, 0));
|
|
5505
|
-
}
|
|
5506
|
-
|
|
5507
|
-
this.min = sub$1(this.min, this.center, this.halfExtents);
|
|
5508
|
-
this.max = add$1(this.max, this.center, this.halfExtents);
|
|
5505
|
+
copy$1(this.center, center);
|
|
5506
|
+
copy$1(this.halfExtents, halfExtents);
|
|
5507
|
+
sub$1(this.min, this.center, this.halfExtents);
|
|
5508
|
+
add$1(this.max, this.center, this.halfExtents);
|
|
5509
5509
|
};
|
|
5510
5510
|
|
|
5511
5511
|
_proto.setMinMax = function setMinMax(min, max) {
|
|
@@ -5943,10 +5943,7 @@
|
|
|
5943
5943
|
alias: 'lineWidth'
|
|
5944
5944
|
},
|
|
5945
5945
|
textAnchor: {
|
|
5946
|
-
alias: 'textAlign'
|
|
5947
|
-
values: {
|
|
5948
|
-
middle: 'center'
|
|
5949
|
-
}
|
|
5946
|
+
alias: 'textAlign'
|
|
5950
5947
|
},
|
|
5951
5948
|
src: {
|
|
5952
5949
|
alias: 'img'
|
|
@@ -5956,18 +5953,8 @@
|
|
|
5956
5953
|
var attributeName = camelCase(name);
|
|
5957
5954
|
var map = FORMAT_ATTR_MAP[attributeName];
|
|
5958
5955
|
attributeName = (map === null || map === void 0 ? void 0 : map.alias) || attributeName;
|
|
5959
|
-
return
|
|
5956
|
+
return attributeName;
|
|
5960
5957
|
});
|
|
5961
|
-
function formatAttribute(name, value) {
|
|
5962
|
-
var _map$values;
|
|
5963
|
-
|
|
5964
|
-
var _formatAttributeName = formatAttributeName(name),
|
|
5965
|
-
attributeName = _formatAttributeName[0],
|
|
5966
|
-
map = _formatAttributeName[1];
|
|
5967
|
-
|
|
5968
|
-
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;
|
|
5969
|
-
return [attributeName, attributeValue];
|
|
5970
|
-
}
|
|
5971
5958
|
|
|
5972
5959
|
var canvasMap = {};
|
|
5973
5960
|
var defaultCanvasIdCounter = 0;
|
|
@@ -11537,16 +11524,23 @@
|
|
|
11537
11524
|
};
|
|
11538
11525
|
|
|
11539
11526
|
_proto.postProcessor = function postProcessor(object) {
|
|
11540
|
-
|
|
11527
|
+
var _object$parsedStyle = object.parsedStyle,
|
|
11528
|
+
offsetPath = _object$parsedStyle.offsetPath,
|
|
11529
|
+
offsetDistance = _object$parsedStyle.offsetDistance;
|
|
11530
|
+
|
|
11531
|
+
if (!offsetPath) {
|
|
11541
11532
|
return;
|
|
11542
11533
|
}
|
|
11543
11534
|
|
|
11544
|
-
var
|
|
11535
|
+
var nodeName = offsetPath.nodeName;
|
|
11545
11536
|
|
|
11546
|
-
if (
|
|
11547
|
-
|
|
11537
|
+
if (nodeName === exports.Shape.LINE || nodeName === exports.Shape.PATH || nodeName === exports.Shape.POLYLINE) {
|
|
11538
|
+
// set position in world space
|
|
11539
|
+
var point = offsetPath.getPoint(offsetDistance);
|
|
11548
11540
|
|
|
11549
11541
|
if (point) {
|
|
11542
|
+
object.parsedStyle.defX = point.x;
|
|
11543
|
+
object.parsedStyle.defY = point.y;
|
|
11550
11544
|
object.setLocalPosition(point.x, point.y);
|
|
11551
11545
|
}
|
|
11552
11546
|
}
|
|
@@ -14156,6 +14150,7 @@
|
|
|
14156
14150
|
// SyncWaterfallHook.prototype = null;
|
|
14157
14151
|
|
|
14158
14152
|
var genericFontFamilies = ['serif', 'sans-serif', 'monospace', 'cursive', 'fantasy', 'system-ui'];
|
|
14153
|
+
var stringRegExp = /([\"\'])[^\'\"]+\1/;
|
|
14159
14154
|
function toFontString(attributes) {
|
|
14160
14155
|
var fontSize = attributes.fontSize,
|
|
14161
14156
|
fontFamily = attributes.fontFamily,
|
|
@@ -14175,7 +14170,7 @@
|
|
|
14175
14170
|
var _fontFamily = fontFamilies[i].trim(); // Check if font already contains strings
|
|
14176
14171
|
|
|
14177
14172
|
|
|
14178
|
-
if (
|
|
14173
|
+
if (!stringRegExp.test(_fontFamily) && genericFontFamilies.indexOf(_fontFamily) < 0) {
|
|
14179
14174
|
_fontFamily = "\"" + _fontFamily + "\"";
|
|
14180
14175
|
}
|
|
14181
14176
|
|
|
@@ -14651,7 +14646,7 @@
|
|
|
14651
14646
|
n: 'textAlign',
|
|
14652
14647
|
l: true,
|
|
14653
14648
|
inh: true,
|
|
14654
|
-
k: ['start', 'center', 'end', 'left', 'right'],
|
|
14649
|
+
k: ['start', 'center', 'middle', 'end', 'left', 'right'],
|
|
14655
14650
|
d: 'start'
|
|
14656
14651
|
}, // {
|
|
14657
14652
|
// n: 'whiteSpace',
|
|
@@ -14680,7 +14675,7 @@
|
|
|
14680
14675
|
d: '0'
|
|
14681
14676
|
}];
|
|
14682
14677
|
var propertyMetadataCache = {};
|
|
14683
|
-
var unresolvedProperties =
|
|
14678
|
+
var unresolvedProperties = new WeakMap();
|
|
14684
14679
|
var priorityMap = {};
|
|
14685
14680
|
var sortAttributeNames = memoize(function (attributeNames) {
|
|
14686
14681
|
return attributeNames.sort(function (a, b) {
|
|
@@ -14692,11 +14687,13 @@
|
|
|
14692
14687
|
var tmpVec3c = create$2();
|
|
14693
14688
|
|
|
14694
14689
|
var isPropertyResolved = function isPropertyResolved(object, name) {
|
|
14695
|
-
|
|
14690
|
+
var properties = unresolvedProperties.get(object);
|
|
14691
|
+
|
|
14692
|
+
if (!properties || properties.length === 0) {
|
|
14696
14693
|
return true;
|
|
14697
14694
|
}
|
|
14698
14695
|
|
|
14699
|
-
return
|
|
14696
|
+
return properties.includes(name);
|
|
14700
14697
|
};
|
|
14701
14698
|
|
|
14702
14699
|
var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
@@ -14761,12 +14758,10 @@
|
|
|
14761
14758
|
attributeNames.forEach(function (attributeName) {
|
|
14762
14759
|
var _propertyMetadataCach;
|
|
14763
14760
|
|
|
14764
|
-
var
|
|
14765
|
-
name = _formatAttribute[0],
|
|
14766
|
-
value = _formatAttribute[1];
|
|
14761
|
+
var name = formatAttributeName(attributeName);
|
|
14767
14762
|
|
|
14768
14763
|
if (!skipUpdateAttribute) {
|
|
14769
|
-
object.attributes[name] =
|
|
14764
|
+
object.attributes[name] = attributes[attributeName];
|
|
14770
14765
|
}
|
|
14771
14766
|
|
|
14772
14767
|
if (!needUpdateGeometry && ((_propertyMetadataCach = propertyMetadataCache[name]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.l)) {
|
|
@@ -14942,12 +14937,15 @@
|
|
|
14942
14937
|
;
|
|
14943
14938
|
|
|
14944
14939
|
_proto.addUnresolveProperty = function addUnresolveProperty(object, name) {
|
|
14945
|
-
|
|
14946
|
-
|
|
14940
|
+
var properties = unresolvedProperties.get(object);
|
|
14941
|
+
|
|
14942
|
+
if (!properties) {
|
|
14943
|
+
unresolvedProperties.set(object, []);
|
|
14944
|
+
properties = unresolvedProperties.get(object);
|
|
14947
14945
|
}
|
|
14948
14946
|
|
|
14949
|
-
if (
|
|
14950
|
-
|
|
14947
|
+
if (properties.indexOf(name) === -1) {
|
|
14948
|
+
properties.push(name);
|
|
14951
14949
|
}
|
|
14952
14950
|
};
|
|
14953
14951
|
|
|
@@ -14983,7 +14981,7 @@
|
|
|
14983
14981
|
};
|
|
14984
14982
|
|
|
14985
14983
|
_proto.recalc = function recalc(object) {
|
|
14986
|
-
var properties = unresolvedProperties
|
|
14984
|
+
var properties = unresolvedProperties.get(object);
|
|
14987
14985
|
|
|
14988
14986
|
if (properties && properties.length) {
|
|
14989
14987
|
var attributes = {};
|
|
@@ -14991,7 +14989,7 @@
|
|
|
14991
14989
|
attributes[property] = object.attributes[property];
|
|
14992
14990
|
});
|
|
14993
14991
|
this.processProperties(object, attributes);
|
|
14994
|
-
delete
|
|
14992
|
+
unresolvedProperties.delete(object);
|
|
14995
14993
|
}
|
|
14996
14994
|
}
|
|
14997
14995
|
/**
|
|
@@ -15899,7 +15897,11 @@
|
|
|
15899
15897
|
*/
|
|
15900
15898
|
;
|
|
15901
15899
|
|
|
15902
|
-
_proto.dispatchEvent = function dispatchEvent(e) {
|
|
15900
|
+
_proto.dispatchEvent = function dispatchEvent(e, skipPropagate) {
|
|
15901
|
+
if (skipPropagate === void 0) {
|
|
15902
|
+
skipPropagate = false;
|
|
15903
|
+
}
|
|
15904
|
+
|
|
15903
15905
|
if (!(e instanceof FederatedEvent)) {
|
|
15904
15906
|
throw new Error('DisplayObject cannot propagate events outside of the Federated Events API');
|
|
15905
15907
|
} // should account for Element / Document / Canvas
|
|
@@ -15929,8 +15931,12 @@
|
|
|
15929
15931
|
|
|
15930
15932
|
e.defaultPrevented = false;
|
|
15931
15933
|
e.path = [];
|
|
15932
|
-
|
|
15933
|
-
(
|
|
15934
|
+
|
|
15935
|
+
if (!skipPropagate) {
|
|
15936
|
+
e.target = this;
|
|
15937
|
+
}
|
|
15938
|
+
|
|
15939
|
+
(_e$manager = e.manager) === null || _e$manager === void 0 ? void 0 : _e$manager.dispatchEvent(e, e.type, skipPropagate);
|
|
15934
15940
|
}
|
|
15935
15941
|
|
|
15936
15942
|
return !e.defaultPrevented;
|
|
@@ -16711,22 +16717,12 @@
|
|
|
16711
16717
|
*/
|
|
16712
16718
|
|
|
16713
16719
|
ElementEvent["INSERTED"] = "DOMNodeInserted";
|
|
16714
|
-
/**
|
|
16715
|
-
* it has had a child inserted
|
|
16716
|
-
*/
|
|
16717
|
-
|
|
16718
|
-
ElementEvent["CHILD_INSERTED"] = "child-inserted";
|
|
16719
16720
|
/**
|
|
16720
16721
|
* it is being removed
|
|
16721
16722
|
* @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeRemoved
|
|
16722
16723
|
*/
|
|
16723
16724
|
|
|
16724
16725
|
ElementEvent["REMOVED"] = "removed";
|
|
16725
|
-
/**
|
|
16726
|
-
* it has had a child removed
|
|
16727
|
-
*/
|
|
16728
|
-
|
|
16729
|
-
ElementEvent["CHILD_REMOVED"] = "child-removed";
|
|
16730
16726
|
/**
|
|
16731
16727
|
* @see https://www.w3.org/TR/DOM-Level-3-Events/#domnodeinsertedintodocument
|
|
16732
16728
|
*/
|
|
@@ -16781,17 +16777,10 @@
|
|
|
16781
16777
|
var entityCounter = 0;
|
|
16782
16778
|
function resetEntityCounter() {
|
|
16783
16779
|
entityCounter = 0;
|
|
16784
|
-
}
|
|
16785
|
-
|
|
16786
|
-
var childInsertedEvent = new CustomEvent(exports.ElementEvent.CHILD_INSERTED, {
|
|
16787
|
-
child: null
|
|
16788
|
-
});
|
|
16780
|
+
}
|
|
16789
16781
|
var insertedEvent = new MutationEvent(exports.ElementEvent.INSERTED, null, '', '', '', 0, '', '');
|
|
16790
16782
|
var removedEvent = new MutationEvent(exports.ElementEvent.REMOVED, null, '', '', '', 0, '', '');
|
|
16791
16783
|
var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
|
|
16792
|
-
var childRemovedEvent = new CustomEvent(exports.ElementEvent.CHILD_REMOVED, {
|
|
16793
|
-
child: null
|
|
16794
|
-
});
|
|
16795
16784
|
/**
|
|
16796
16785
|
* Has following capabilities:
|
|
16797
16786
|
* * Node insert/remove, eg. appendChild, removeChild, remove...
|
|
@@ -16929,19 +16918,13 @@
|
|
|
16929
16918
|
};
|
|
16930
16919
|
|
|
16931
16920
|
_proto.appendChild = function appendChild(child, index) {
|
|
16932
|
-
|
|
16933
|
-
|
|
16934
|
-
|
|
16935
|
-
|
|
16936
|
-
|
|
16937
|
-
|
|
16938
|
-
|
|
16939
|
-
// this.ownerDocument?.defaultView?.mountChildren(child);
|
|
16940
|
-
|
|
16941
|
-
this.dispatchEvent(childInsertedEvent); // child.emit(ElementEvent.INSERTED, {
|
|
16942
|
-
// parent: this,
|
|
16943
|
-
// index,
|
|
16944
|
-
// });
|
|
16921
|
+
var _this$ownerDocument;
|
|
16922
|
+
|
|
16923
|
+
runtime.sceneGraphService.attach(child, this, index);
|
|
16924
|
+
|
|
16925
|
+
if ((_this$ownerDocument = this.ownerDocument) === null || _this$ownerDocument === void 0 ? void 0 : _this$ownerDocument.defaultView) {
|
|
16926
|
+
this.ownerDocument.defaultView.mountChildren(child);
|
|
16927
|
+
}
|
|
16945
16928
|
|
|
16946
16929
|
insertedEvent.relatedNode = this;
|
|
16947
16930
|
child.dispatchEvent(insertedEvent);
|
|
@@ -16967,36 +16950,18 @@
|
|
|
16967
16950
|
};
|
|
16968
16951
|
|
|
16969
16952
|
_proto.removeChild = function removeChild(child) {
|
|
16953
|
+
var _child$ownerDocument;
|
|
16954
|
+
|
|
16970
16955
|
// should emit on itself before detach
|
|
16971
|
-
// child.emit(ElementEvent.REMOVED, {
|
|
16972
|
-
// parent: this,
|
|
16973
|
-
// });
|
|
16974
16956
|
removedEvent.relatedNode = this;
|
|
16975
|
-
child.dispatchEvent(removedEvent);
|
|
16976
|
-
// if (destroy) {
|
|
16977
|
-
// // child.destroy();
|
|
16978
|
-
// child.dispatchEvent(destroyEvent);
|
|
16979
|
-
// (child as unknown as Element).destroyed = true;
|
|
16980
|
-
// }
|
|
16981
|
-
// emit on parent
|
|
16982
|
-
|
|
16983
|
-
childRemovedEvent.detail.child = child;
|
|
16984
|
-
this.dispatchEvent(childRemovedEvent); // this.dispatchEvent(
|
|
16985
|
-
// new CustomEvent(ElementEvent.CHILD_REMOVED, {
|
|
16986
|
-
// child,
|
|
16987
|
-
// }),
|
|
16988
|
-
// );
|
|
16989
|
-
// remove from scene graph
|
|
16990
|
-
|
|
16991
|
-
runtime.sceneGraphService.detach(child); // cannot emit Destroy event now
|
|
16992
|
-
// if (destroy) {
|
|
16993
|
-
// // this.removeChildren();
|
|
16994
|
-
// // remove event listeners
|
|
16995
|
-
// // @ts-ignore
|
|
16996
|
-
// child.emitter.removeAllListeners();
|
|
16997
|
-
// displayObjectPool.remove((child as unknown as Element).entity);
|
|
16998
|
-
// }
|
|
16957
|
+
child.dispatchEvent(removedEvent);
|
|
16999
16958
|
|
|
16959
|
+
if ((_child$ownerDocument = child.ownerDocument) === null || _child$ownerDocument === void 0 ? void 0 : _child$ownerDocument.defaultView) {
|
|
16960
|
+
child.ownerDocument.defaultView.unmountChildren(child);
|
|
16961
|
+
} // remove from scene graph
|
|
16962
|
+
|
|
16963
|
+
|
|
16964
|
+
runtime.sceneGraphService.detach(child);
|
|
17000
16965
|
return child;
|
|
17001
16966
|
}
|
|
17002
16967
|
/**
|
|
@@ -17289,14 +17254,13 @@
|
|
|
17289
17254
|
var value = this.attributes[name];
|
|
17290
17255
|
|
|
17291
17256
|
if (value === undefined) {
|
|
17292
|
-
var
|
|
17293
|
-
|
|
17294
|
-
|
|
17295
|
-
value = this.attributes[attributeName];
|
|
17296
|
-
} // if the given attribute does not exist, the value returned will either be null or ""
|
|
17257
|
+
var attributeName = formatAttributeName(name);
|
|
17258
|
+
value = this.attributes[attributeName]; // if the given attribute does not exist, the value returned will either be null or ""
|
|
17297
17259
|
|
|
17298
|
-
|
|
17299
|
-
|
|
17260
|
+
return isNil(value) ? null : value;
|
|
17261
|
+
} else {
|
|
17262
|
+
return value;
|
|
17263
|
+
}
|
|
17300
17264
|
}
|
|
17301
17265
|
/**
|
|
17302
17266
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
|
|
@@ -17699,6 +17663,7 @@
|
|
|
17699
17663
|
filter: [],
|
|
17700
17664
|
shadowType: 'outer'
|
|
17701
17665
|
};
|
|
17666
|
+
var INHERITABLE_STYLE_PROPS = ['opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform'];
|
|
17702
17667
|
/**
|
|
17703
17668
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
17704
17669
|
*
|
|
@@ -17738,7 +17703,13 @@
|
|
|
17738
17703
|
|
|
17739
17704
|
_this.config = void 0;
|
|
17740
17705
|
_this.isCustomElement = false;
|
|
17706
|
+
_this.isMutationObserved = false;
|
|
17741
17707
|
_this.activeAnimations = [];
|
|
17708
|
+
|
|
17709
|
+
_this.getClip = function () {
|
|
17710
|
+
return this.style.clipPath || null;
|
|
17711
|
+
};
|
|
17712
|
+
|
|
17742
17713
|
_this.config = config; // compatible with G 3.0
|
|
17743
17714
|
|
|
17744
17715
|
_this.config.interactive = (_this$config$capture = _this.config.capture) !== null && _this$config$capture !== void 0 ? _this$config$capture : _this.config.interactive; // init scene graph node
|
|
@@ -17867,14 +17838,7 @@
|
|
|
17867
17838
|
|
|
17868
17839
|
runtime.styleValueRegistry.processProperties(this, attributes, {
|
|
17869
17840
|
forceUpdateGeometry: true,
|
|
17870
|
-
usedAttributes:
|
|
17871
|
-
// 'transform',
|
|
17872
|
-
// 'zIndex',
|
|
17873
|
-
// 'filter',
|
|
17874
|
-
// 'shadowType',
|
|
17875
|
-
// 'fill',
|
|
17876
|
-
// 'stroke',
|
|
17877
|
-
'opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform']
|
|
17841
|
+
usedAttributes: INHERITABLE_STYLE_PROPS
|
|
17878
17842
|
}); // redraw at next frame
|
|
17879
17843
|
|
|
17880
17844
|
renderable.dirty = true;
|
|
@@ -17885,19 +17849,16 @@
|
|
|
17885
17849
|
force = false;
|
|
17886
17850
|
}
|
|
17887
17851
|
|
|
17888
|
-
var
|
|
17889
|
-
attributeName = _formatAttribute[0],
|
|
17890
|
-
attributeValue = _formatAttribute[1]; // ignore undefined value
|
|
17891
|
-
|
|
17852
|
+
var attributeName = formatAttributeName(name); // ignore undefined value
|
|
17892
17853
|
|
|
17893
17854
|
if (isUndefined(value)) {
|
|
17894
17855
|
return;
|
|
17895
17856
|
}
|
|
17896
17857
|
|
|
17897
|
-
if (force ||
|
|
17898
|
-
this.internalSetAttribute(attributeName,
|
|
17858
|
+
if (force || value !== this.attributes[attributeName]) {
|
|
17859
|
+
this.internalSetAttribute(attributeName, value);
|
|
17899
17860
|
|
|
17900
|
-
_Element.prototype.setAttribute.call(this, attributeName,
|
|
17861
|
+
_Element.prototype.setAttribute.call(this, attributeName, value);
|
|
17901
17862
|
}
|
|
17902
17863
|
}
|
|
17903
17864
|
/**
|
|
@@ -17927,7 +17888,13 @@
|
|
|
17927
17888
|
mutationEvent.attrName = name;
|
|
17928
17889
|
mutationEvent.prevParsedValue = oldParsedValue;
|
|
17929
17890
|
mutationEvent.newParsedValue = newParsedValue;
|
|
17930
|
-
|
|
17891
|
+
|
|
17892
|
+
if (this.isMutationObserved) {
|
|
17893
|
+
this.dispatchEvent(mutationEvent);
|
|
17894
|
+
} else {
|
|
17895
|
+
mutationEvent.target = this;
|
|
17896
|
+
this.ownerDocument.defaultView.dispatchEvent(mutationEvent, true);
|
|
17897
|
+
}
|
|
17931
17898
|
}
|
|
17932
17899
|
|
|
17933
17900
|
if ((this.isCustomElement && this.isConnected || !this.isCustomElement) && this.attributeChangedCallback) {
|
|
@@ -18111,10 +18078,7 @@
|
|
|
18111
18078
|
;
|
|
18112
18079
|
|
|
18113
18080
|
_proto.getEulerAngles = function getEulerAngles() {
|
|
18114
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18115
18081
|
var _getEuler = getEuler(create$2(), runtime.sceneGraphService.getWorldTransform(this)),
|
|
18116
|
-
ex = _getEuler[0],
|
|
18117
|
-
ey = _getEuler[1],
|
|
18118
18082
|
ez = _getEuler[2];
|
|
18119
18083
|
|
|
18120
18084
|
return rad2deg(ez);
|
|
@@ -18125,10 +18089,7 @@
|
|
|
18125
18089
|
;
|
|
18126
18090
|
|
|
18127
18091
|
_proto.getLocalEulerAngles = function getLocalEulerAngles() {
|
|
18128
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18129
18092
|
var _getEuler2 = getEuler(create$2(), runtime.sceneGraphService.getLocalRotation(this)),
|
|
18130
|
-
ex = _getEuler2[0],
|
|
18131
|
-
ey = _getEuler2[1],
|
|
18132
18093
|
ez = _getEuler2[2];
|
|
18133
18094
|
|
|
18134
18095
|
return rad2deg(ez);
|
|
@@ -18355,11 +18316,10 @@
|
|
|
18355
18316
|
sx = _mat4$getScaling[0],
|
|
18356
18317
|
sy = _mat4$getScaling[1];
|
|
18357
18318
|
|
|
18358
|
-
var rotation = getRotation(create$4(), transform);
|
|
18319
|
+
var rotation = getRotation(create$4(), transform);
|
|
18359
18320
|
|
|
18360
18321
|
var _getEuler3 = getEuler(create$2(), rotation),
|
|
18361
18322
|
eux = _getEuler3[0],
|
|
18362
|
-
euy = _getEuler3[1],
|
|
18363
18323
|
euz = _getEuler3[2]; // gimbal lock at 90 degrees
|
|
18364
18324
|
|
|
18365
18325
|
|
|
@@ -18423,6 +18383,145 @@
|
|
|
18423
18383
|
|
|
18424
18384
|
_proto.hide = function hide() {
|
|
18425
18385
|
this.style.visibility = 'hidden';
|
|
18386
|
+
}
|
|
18387
|
+
/**
|
|
18388
|
+
* Use `childElementCount` instead.
|
|
18389
|
+
* @deprecated
|
|
18390
|
+
*/
|
|
18391
|
+
;
|
|
18392
|
+
|
|
18393
|
+
_proto.getCount = function getCount() {
|
|
18394
|
+
return this.childElementCount;
|
|
18395
|
+
}
|
|
18396
|
+
/**
|
|
18397
|
+
* Use `parentElement` instead.
|
|
18398
|
+
* @deprecated
|
|
18399
|
+
*/
|
|
18400
|
+
;
|
|
18401
|
+
|
|
18402
|
+
_proto.getParent = function getParent() {
|
|
18403
|
+
return this.parentElement;
|
|
18404
|
+
}
|
|
18405
|
+
/**
|
|
18406
|
+
* Use `children` instead.
|
|
18407
|
+
* @deprecated
|
|
18408
|
+
*/
|
|
18409
|
+
;
|
|
18410
|
+
|
|
18411
|
+
_proto.getChildren = function getChildren() {
|
|
18412
|
+
return this.children;
|
|
18413
|
+
}
|
|
18414
|
+
/**
|
|
18415
|
+
* Use `firstElementChild` instead.
|
|
18416
|
+
* @deprecated
|
|
18417
|
+
*/
|
|
18418
|
+
;
|
|
18419
|
+
|
|
18420
|
+
_proto.getFirst = function getFirst() {
|
|
18421
|
+
return this.firstElementChild;
|
|
18422
|
+
}
|
|
18423
|
+
/**
|
|
18424
|
+
* Use `lastElementChild` instead.
|
|
18425
|
+
* @deprecated
|
|
18426
|
+
*/
|
|
18427
|
+
;
|
|
18428
|
+
|
|
18429
|
+
_proto.getLast = function getLast() {
|
|
18430
|
+
return this.lastElementChild;
|
|
18431
|
+
}
|
|
18432
|
+
/**
|
|
18433
|
+
* Use `this.children[index]` instead.
|
|
18434
|
+
* @deprecated
|
|
18435
|
+
*/
|
|
18436
|
+
;
|
|
18437
|
+
|
|
18438
|
+
_proto.getChildByIndex = function getChildByIndex(index) {
|
|
18439
|
+
return this.children[index] || null;
|
|
18440
|
+
}
|
|
18441
|
+
/**
|
|
18442
|
+
* Use `appendChild` instead.
|
|
18443
|
+
* @deprecated
|
|
18444
|
+
*/
|
|
18445
|
+
;
|
|
18446
|
+
|
|
18447
|
+
_proto.add = function add(child, index) {
|
|
18448
|
+
return this.appendChild(child, index);
|
|
18449
|
+
}
|
|
18450
|
+
/**
|
|
18451
|
+
* Use `this.style.clipPath` instead.
|
|
18452
|
+
* @deprecated
|
|
18453
|
+
*/
|
|
18454
|
+
;
|
|
18455
|
+
|
|
18456
|
+
_proto.setClip = function setClip(clipPath) {
|
|
18457
|
+
this.style.clipPath = clipPath;
|
|
18458
|
+
}
|
|
18459
|
+
/**
|
|
18460
|
+
* Use `this.style.clipPath` instead.
|
|
18461
|
+
* @deprecated
|
|
18462
|
+
*/
|
|
18463
|
+
;
|
|
18464
|
+
|
|
18465
|
+
/**
|
|
18466
|
+
* @deprecated
|
|
18467
|
+
*/
|
|
18468
|
+
_proto.set = function set(name, value) {
|
|
18469
|
+
// @ts-ignore
|
|
18470
|
+
this.config[name] = value;
|
|
18471
|
+
}
|
|
18472
|
+
/**
|
|
18473
|
+
* @deprecated
|
|
18474
|
+
*/
|
|
18475
|
+
;
|
|
18476
|
+
|
|
18477
|
+
_proto.get = function get(name) {
|
|
18478
|
+
return this.config[name];
|
|
18479
|
+
}
|
|
18480
|
+
/**
|
|
18481
|
+
* Use `setPosition` instead.
|
|
18482
|
+
* @deprecated
|
|
18483
|
+
*/
|
|
18484
|
+
;
|
|
18485
|
+
|
|
18486
|
+
_proto.moveTo = function moveTo(position, y, z) {
|
|
18487
|
+
if (y === void 0) {
|
|
18488
|
+
y = 0;
|
|
18489
|
+
}
|
|
18490
|
+
|
|
18491
|
+
if (z === void 0) {
|
|
18492
|
+
z = 0;
|
|
18493
|
+
}
|
|
18494
|
+
|
|
18495
|
+
this.setPosition(position, y, z);
|
|
18496
|
+
return this;
|
|
18497
|
+
}
|
|
18498
|
+
/**
|
|
18499
|
+
* Use `setPosition` instead.
|
|
18500
|
+
* @deprecated
|
|
18501
|
+
*/
|
|
18502
|
+
;
|
|
18503
|
+
|
|
18504
|
+
_proto.move = function move(position, y, z) {
|
|
18505
|
+
if (y === void 0) {
|
|
18506
|
+
y = 0;
|
|
18507
|
+
}
|
|
18508
|
+
|
|
18509
|
+
if (z === void 0) {
|
|
18510
|
+
z = 0;
|
|
18511
|
+
}
|
|
18512
|
+
|
|
18513
|
+
this.setPosition(position, y, z);
|
|
18514
|
+
return this;
|
|
18515
|
+
}
|
|
18516
|
+
/**
|
|
18517
|
+
* Use `this.style.zIndex` instead.
|
|
18518
|
+
* @deprecated
|
|
18519
|
+
*/
|
|
18520
|
+
;
|
|
18521
|
+
|
|
18522
|
+
_proto.setZIndex = function setZIndex(zIndex) {
|
|
18523
|
+
this.style.zIndex = zIndex;
|
|
18524
|
+
return this;
|
|
18426
18525
|
};
|
|
18427
18526
|
|
|
18428
18527
|
_createClass(DisplayObject, [{
|
|
@@ -18852,7 +18951,11 @@
|
|
|
18852
18951
|
marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
|
|
18853
18952
|
};
|
|
18854
18953
|
|
|
18855
|
-
_proto.getPoint = function getPoint(ratio) {
|
|
18954
|
+
_proto.getPoint = function getPoint(ratio, inWorldSpace) {
|
|
18955
|
+
if (inWorldSpace === void 0) {
|
|
18956
|
+
inWorldSpace = false;
|
|
18957
|
+
}
|
|
18958
|
+
|
|
18856
18959
|
// TODO: account for z1/z2 in 3D line
|
|
18857
18960
|
var _this$parsedStyle3 = this.parsedStyle,
|
|
18858
18961
|
x1 = _this$parsedStyle3.x1,
|
|
@@ -18866,13 +18969,17 @@
|
|
|
18866
18969
|
x = _LineUtil$pointAt.x,
|
|
18867
18970
|
y = _LineUtil$pointAt.y;
|
|
18868
18971
|
|
|
18869
|
-
var transformed = transformMat4(create$2(), fromValues$2(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
|
|
18972
|
+
var transformed = transformMat4(create$2(), fromValues$2(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform()); // apply local transformation
|
|
18870
18973
|
|
|
18871
18974
|
return new Point(transformed[0], transformed[1]);
|
|
18872
18975
|
};
|
|
18873
18976
|
|
|
18874
|
-
_proto.getPointAtLength = function getPointAtLength(distance) {
|
|
18875
|
-
|
|
18977
|
+
_proto.getPointAtLength = function getPointAtLength(distance, inWorldSpace) {
|
|
18978
|
+
if (inWorldSpace === void 0) {
|
|
18979
|
+
inWorldSpace = false;
|
|
18980
|
+
}
|
|
18981
|
+
|
|
18982
|
+
return this.getPoint(distance / this.getTotalLength(), inWorldSpace);
|
|
18876
18983
|
};
|
|
18877
18984
|
|
|
18878
18985
|
_proto.getTotalLength = function getTotalLength() {
|
|
@@ -19069,7 +19176,11 @@
|
|
|
19069
19176
|
*/
|
|
19070
19177
|
;
|
|
19071
19178
|
|
|
19072
|
-
_proto.getPointAtLength = function getPointAtLength$1(distance) {
|
|
19179
|
+
_proto.getPointAtLength = function getPointAtLength$1(distance, inWorldSpace) {
|
|
19180
|
+
if (inWorldSpace === void 0) {
|
|
19181
|
+
inWorldSpace = false;
|
|
19182
|
+
}
|
|
19183
|
+
|
|
19073
19184
|
var _this$parsedStyle4 = this.parsedStyle,
|
|
19074
19185
|
defX = _this$parsedStyle4.defX,
|
|
19075
19186
|
defY = _this$parsedStyle4.defY,
|
|
@@ -19079,7 +19190,7 @@
|
|
|
19079
19190
|
x = _getPointAtLength2.x,
|
|
19080
19191
|
y = _getPointAtLength2.y;
|
|
19081
19192
|
|
|
19082
|
-
var transformed = transformMat4(create$2(), fromValues$2(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
|
|
19193
|
+
var transformed = transformMat4(create$2(), fromValues$2(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform()); // apply local transformation
|
|
19083
19194
|
|
|
19084
19195
|
return new Point(transformed[0], transformed[1]);
|
|
19085
19196
|
}
|
|
@@ -19088,8 +19199,12 @@
|
|
|
19088
19199
|
*/
|
|
19089
19200
|
;
|
|
19090
19201
|
|
|
19091
|
-
_proto.getPoint = function getPoint(ratio) {
|
|
19092
|
-
|
|
19202
|
+
_proto.getPoint = function getPoint(ratio, inWorldSpace) {
|
|
19203
|
+
if (inWorldSpace === void 0) {
|
|
19204
|
+
inWorldSpace = false;
|
|
19205
|
+
}
|
|
19206
|
+
|
|
19207
|
+
return this.getPointAtLength(ratio * getOrCalculatePathTotalLength(this), inWorldSpace);
|
|
19093
19208
|
}
|
|
19094
19209
|
/**
|
|
19095
19210
|
* Get start tangent vector
|
|
@@ -19348,11 +19463,19 @@
|
|
|
19348
19463
|
return this.parsedStyle.points.totalLength;
|
|
19349
19464
|
};
|
|
19350
19465
|
|
|
19351
|
-
_proto.getPointAtLength = function getPointAtLength(distance) {
|
|
19352
|
-
|
|
19466
|
+
_proto.getPointAtLength = function getPointAtLength(distance, inWorldSpace) {
|
|
19467
|
+
if (inWorldSpace === void 0) {
|
|
19468
|
+
inWorldSpace = false;
|
|
19469
|
+
}
|
|
19470
|
+
|
|
19471
|
+
return this.getPoint(distance / this.getTotalLength(), inWorldSpace);
|
|
19353
19472
|
};
|
|
19354
19473
|
|
|
19355
|
-
_proto.getPoint = function getPoint(ratio) {
|
|
19474
|
+
_proto.getPoint = function getPoint(ratio, inWorldSpace) {
|
|
19475
|
+
if (inWorldSpace === void 0) {
|
|
19476
|
+
inWorldSpace = false;
|
|
19477
|
+
}
|
|
19478
|
+
|
|
19356
19479
|
var _this$parsedStyle = this.parsedStyle,
|
|
19357
19480
|
defX = _this$parsedStyle.defX,
|
|
19358
19481
|
defY = _this$parsedStyle.defY,
|
|
@@ -19372,7 +19495,7 @@
|
|
|
19372
19495
|
x = _LineUtil$pointAt.x,
|
|
19373
19496
|
y = _LineUtil$pointAt.y;
|
|
19374
19497
|
|
|
19375
|
-
var transformed = transformMat4(create$2(), fromValues$2(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
|
|
19498
|
+
var transformed = transformMat4(create$2(), fromValues$2(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform()); // apply local transformation
|
|
19376
19499
|
|
|
19377
19500
|
return new Point(transformed[0], transformed[1]);
|
|
19378
19501
|
};
|
|
@@ -19878,18 +20001,25 @@
|
|
|
19878
20001
|
ox = _this$canvas$viewport.x,
|
|
19879
20002
|
oy = _this$canvas$viewport.y;
|
|
19880
20003
|
|
|
20004
|
+
var roll = this.roll;
|
|
20005
|
+
this.rotate(0, 0, -roll);
|
|
19881
20006
|
this.setPosition(ox, oy);
|
|
19882
20007
|
this.setFocalPoint(ox, oy);
|
|
19883
20008
|
this.setZoom(zoom);
|
|
20009
|
+
this.rotate(0, 0, roll);
|
|
19884
20010
|
|
|
19885
20011
|
var _this$canvas$viewport2 = this.canvas.viewport2Canvas({
|
|
19886
20012
|
x: viewportPoint[0],
|
|
19887
20013
|
y: viewportPoint[1]
|
|
19888
20014
|
}),
|
|
19889
20015
|
cx = _this$canvas$viewport2.x,
|
|
19890
|
-
cy = _this$canvas$viewport2.y;
|
|
20016
|
+
cy = _this$canvas$viewport2.y; // project to rotated axis
|
|
20017
|
+
|
|
19891
20018
|
|
|
19892
|
-
|
|
20019
|
+
var dvec = fromValues$2(cx - ox, cy - oy, 0);
|
|
20020
|
+
var dx = dot(dvec, this.right) / length(this.right);
|
|
20021
|
+
var dy = dot(dvec, this.up) / length(this.up);
|
|
20022
|
+
this.pan(-dx, -dy);
|
|
19893
20023
|
return this;
|
|
19894
20024
|
};
|
|
19895
20025
|
|
|
@@ -20553,7 +20683,7 @@
|
|
|
20553
20683
|
var anchor = [0, 1];
|
|
20554
20684
|
var lineXOffset = 0;
|
|
20555
20685
|
|
|
20556
|
-
if (textAlign === 'center') {
|
|
20686
|
+
if (textAlign === 'center' || textAlign === 'middle') {
|
|
20557
20687
|
lineXOffset = lineWidth / 2;
|
|
20558
20688
|
anchor = [0.5, 1];
|
|
20559
20689
|
} else if (textAlign === 'right' || textAlign === 'end') {
|
|
@@ -21278,10 +21408,20 @@
|
|
|
21278
21408
|
}
|
|
21279
21409
|
};
|
|
21280
21410
|
|
|
21281
|
-
_proto.dispatchEvent = function dispatchEvent(e, type) {
|
|
21282
|
-
|
|
21283
|
-
|
|
21284
|
-
|
|
21411
|
+
_proto.dispatchEvent = function dispatchEvent(e, type, skipPropagate) {
|
|
21412
|
+
// Canvas should skip
|
|
21413
|
+
if (!skipPropagate) {
|
|
21414
|
+
e.propagationStopped = false;
|
|
21415
|
+
e.propagationImmediatelyStopped = false;
|
|
21416
|
+
this.propagate(e, type);
|
|
21417
|
+
} else {
|
|
21418
|
+
// target phase
|
|
21419
|
+
e.eventPhase = e.AT_TARGET;
|
|
21420
|
+
var canvas = this.rootTarget.defaultView || null;
|
|
21421
|
+
e.currentTarget = canvas;
|
|
21422
|
+
this.notifyListeners(e, type);
|
|
21423
|
+
}
|
|
21424
|
+
|
|
21285
21425
|
this.emitter.emit(type || e.type, e);
|
|
21286
21426
|
};
|
|
21287
21427
|
|
|
@@ -22087,10 +22227,11 @@
|
|
|
22087
22227
|
|
|
22088
22228
|
if (renderOrderChanged) {
|
|
22089
22229
|
displayObject.forEach(function (child) {
|
|
22230
|
+
_this2.renderOrderChangedEvent.target = child;
|
|
22090
22231
|
_this2.renderOrderChangedEvent.detail = {
|
|
22091
22232
|
renderOrder: child.sortable.renderOrder
|
|
22092
22233
|
};
|
|
22093
|
-
child.dispatchEvent(_this2.renderOrderChangedEvent);
|
|
22234
|
+
child.ownerDocument.defaultView.dispatchEvent(_this2.renderOrderChangedEvent, true);
|
|
22094
22235
|
});
|
|
22095
22236
|
}
|
|
22096
22237
|
};
|
|
@@ -22751,9 +22892,10 @@
|
|
|
22751
22892
|
var set = new Set();
|
|
22752
22893
|
|
|
22753
22894
|
var trigger = function trigger(element, detail) {
|
|
22754
|
-
if (!set.has(element.entity)) {
|
|
22895
|
+
if (element.isConnected && !set.has(element.entity)) {
|
|
22755
22896
|
_this2.boundsChangedEvent.detail = detail;
|
|
22756
|
-
|
|
22897
|
+
_this2.boundsChangedEvent.target = element;
|
|
22898
|
+
element.ownerDocument.defaultView.dispatchEvent(_this2.boundsChangedEvent, true);
|
|
22757
22899
|
set.add(element.entity);
|
|
22758
22900
|
}
|
|
22759
22901
|
};
|
|
@@ -22771,6 +22913,7 @@
|
|
|
22771
22913
|
}
|
|
22772
22914
|
});
|
|
22773
22915
|
this.pendingEvents = [];
|
|
22916
|
+
set.clear();
|
|
22774
22917
|
};
|
|
22775
22918
|
|
|
22776
22919
|
_proto.dirtifyToRoot = function dirtifyToRoot(element, affectChildren) {
|
|
@@ -23421,7 +23564,7 @@
|
|
|
23421
23564
|
lineMetrics: lineWidths.map(function (width, i) {
|
|
23422
23565
|
var offsetX = 0; // handle horizontal text align
|
|
23423
23566
|
|
|
23424
|
-
if (textAlign === 'center') {
|
|
23567
|
+
if (textAlign === 'center' || textAlign === 'middle') {
|
|
23425
23568
|
offsetX -= width / 2;
|
|
23426
23569
|
} else if (textAlign === 'right' || textAlign === 'end') {
|
|
23427
23570
|
offsetX -= width;
|
|
@@ -24253,21 +24396,14 @@
|
|
|
24253
24396
|
|
|
24254
24397
|
var _proto = PrepareRendererPlugin.prototype;
|
|
24255
24398
|
|
|
24256
|
-
|
|
24257
|
-
var _this = this;
|
|
24258
|
-
|
|
24259
|
-
list.forEach(function (i) {
|
|
24260
|
-
_this.toSync.add(i);
|
|
24261
|
-
});
|
|
24262
|
-
} // private isFirstTimeRendering = true;
|
|
24263
|
-
;
|
|
24264
|
-
|
|
24399
|
+
// private isFirstTimeRendering = true;
|
|
24265
24400
|
_proto.apply = function apply(context) {
|
|
24266
|
-
var
|
|
24401
|
+
var _this = this;
|
|
24267
24402
|
|
|
24268
24403
|
var renderingService = context.renderingService,
|
|
24269
24404
|
renderingContext = context.renderingContext,
|
|
24270
24405
|
rBushRoot = context.rBushRoot;
|
|
24406
|
+
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
24271
24407
|
this.rBush = rBushRoot;
|
|
24272
24408
|
|
|
24273
24409
|
var handleAttributeChanged = function handleAttributeChanged(e) {
|
|
@@ -24282,20 +24418,26 @@
|
|
|
24282
24418
|
|
|
24283
24419
|
if (affectChildren) {
|
|
24284
24420
|
object.forEach(function (node) {
|
|
24285
|
-
|
|
24421
|
+
_this.toSync.add(node);
|
|
24286
24422
|
});
|
|
24287
24423
|
}
|
|
24288
24424
|
|
|
24289
|
-
|
|
24425
|
+
var p = object;
|
|
24426
|
+
|
|
24427
|
+
while (p) {
|
|
24428
|
+
if (p.renderable) {
|
|
24429
|
+
_this.toSync.add(p);
|
|
24430
|
+
}
|
|
24431
|
+
|
|
24432
|
+
p = p.parentElement;
|
|
24433
|
+
} // this.pushToSync(e.composedPath().slice(0, -2) as DisplayObject[]);
|
|
24434
|
+
|
|
24290
24435
|
|
|
24291
24436
|
renderingService.dirtify();
|
|
24292
24437
|
};
|
|
24293
24438
|
|
|
24294
24439
|
var handleMounted = function handleMounted(e) {
|
|
24295
|
-
var object = e.target;
|
|
24296
|
-
|
|
24297
|
-
_this2.pushToSync(e.composedPath().slice(0, -2)); // recalc style values
|
|
24298
|
-
|
|
24440
|
+
var object = e.target; // recalc style values
|
|
24299
24441
|
|
|
24300
24442
|
runtime.styleValueRegistry.recalc(object);
|
|
24301
24443
|
runtime.sceneGraphService.dirtifyToRoot(object);
|
|
@@ -24307,12 +24449,12 @@
|
|
|
24307
24449
|
var rBushNode = object.rBushNode;
|
|
24308
24450
|
|
|
24309
24451
|
if (rBushNode.aabb) {
|
|
24310
|
-
|
|
24452
|
+
_this.rBush.remove(rBushNode.aabb);
|
|
24311
24453
|
}
|
|
24312
24454
|
|
|
24313
|
-
|
|
24455
|
+
_this.toSync.delete(object);
|
|
24314
24456
|
|
|
24315
|
-
runtime.sceneGraphService.dirtifyToRoot(
|
|
24457
|
+
runtime.sceneGraphService.dirtifyToRoot(object);
|
|
24316
24458
|
renderingService.dirtify();
|
|
24317
24459
|
};
|
|
24318
24460
|
|
|
@@ -24321,10 +24463,10 @@
|
|
|
24321
24463
|
while (1) {
|
|
24322
24464
|
switch (_context.prev = _context.next) {
|
|
24323
24465
|
case 0:
|
|
24324
|
-
|
|
24325
|
-
|
|
24326
|
-
|
|
24327
|
-
|
|
24466
|
+
canvas.addEventListener(exports.ElementEvent.MOUNTED, handleMounted);
|
|
24467
|
+
canvas.addEventListener(exports.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
24468
|
+
canvas.addEventListener(exports.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
24469
|
+
canvas.addEventListener(exports.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
24328
24470
|
|
|
24329
24471
|
case 4:
|
|
24330
24472
|
case "end":
|
|
@@ -24334,10 +24476,10 @@
|
|
|
24334
24476
|
}, _callee);
|
|
24335
24477
|
})));
|
|
24336
24478
|
renderingService.hooks.destroy.tap(PrepareRendererPlugin.tag, function () {
|
|
24337
|
-
|
|
24338
|
-
|
|
24339
|
-
|
|
24340
|
-
|
|
24479
|
+
canvas.removeEventListener(exports.ElementEvent.MOUNTED, handleMounted);
|
|
24480
|
+
canvas.removeEventListener(exports.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
24481
|
+
canvas.removeEventListener(exports.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
24482
|
+
canvas.removeEventListener(exports.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
24341
24483
|
});
|
|
24342
24484
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
24343
24485
|
// if (this.isFirstTimeRendering) {
|
|
@@ -24347,12 +24489,12 @@
|
|
|
24347
24489
|
// } else {
|
|
24348
24490
|
// this.syncRTree();
|
|
24349
24491
|
// }
|
|
24350
|
-
|
|
24492
|
+
_this.syncRTree();
|
|
24351
24493
|
});
|
|
24352
24494
|
};
|
|
24353
24495
|
|
|
24354
24496
|
_proto.syncRTree = function syncRTree() {
|
|
24355
|
-
var
|
|
24497
|
+
var _this2 = this;
|
|
24356
24498
|
|
|
24357
24499
|
// bounds changed, need re-inserting its children
|
|
24358
24500
|
var bulk = [];
|
|
@@ -24363,7 +24505,7 @@
|
|
|
24363
24505
|
var rBushNode = node.rBushNode; // clear dirty node
|
|
24364
24506
|
|
|
24365
24507
|
if (rBushNode && rBushNode.aabb) {
|
|
24366
|
-
|
|
24508
|
+
_this2.rBush.remove(rBushNode.aabb);
|
|
24367
24509
|
}
|
|
24368
24510
|
|
|
24369
24511
|
var renderBounds = node.getRenderBounds();
|
|
@@ -24420,6 +24562,14 @@
|
|
|
24420
24562
|
var DEFAULT_CAMERA_Z = 500;
|
|
24421
24563
|
var DEFAULT_CAMERA_NEAR = 0.1;
|
|
24422
24564
|
var DEFAULT_CAMERA_FAR = 1000;
|
|
24565
|
+
/**
|
|
24566
|
+
* reuse custom event preventing from re-create them in every frame
|
|
24567
|
+
*/
|
|
24568
|
+
|
|
24569
|
+
var mountedEvent = new CustomEvent(exports.ElementEvent.MOUNTED);
|
|
24570
|
+
var unmountedEvent = new CustomEvent(exports.ElementEvent.UNMOUNTED);
|
|
24571
|
+
var beforeRenderEvent = new CustomEvent(exports.CanvasEvent.BEFORE_RENDER);
|
|
24572
|
+
var afterRenderEvent = new CustomEvent(exports.CanvasEvent.AFTER_RENDER);
|
|
24423
24573
|
/**
|
|
24424
24574
|
* can be treated like Window in DOM
|
|
24425
24575
|
* provide some extra methods like `window`, such as:
|
|
@@ -24477,10 +24627,6 @@
|
|
|
24477
24627
|
/**
|
|
24478
24628
|
* rAF in auto rendering
|
|
24479
24629
|
*/
|
|
24480
|
-
|
|
24481
|
-
/**
|
|
24482
|
-
* reuse custom event preventing from re-create them in every frame
|
|
24483
|
-
*/
|
|
24484
24630
|
function Canvas(config) {
|
|
24485
24631
|
var _this;
|
|
24486
24632
|
|
|
@@ -24500,10 +24646,6 @@
|
|
|
24500
24646
|
_this.inited = false;
|
|
24501
24647
|
_this.readyPromise = void 0;
|
|
24502
24648
|
_this.resolveReadyPromise = void 0;
|
|
24503
|
-
_this.mountEvent = new CustomEvent(exports.ElementEvent.MOUNTED);
|
|
24504
|
-
_this.unmountEvent = new CustomEvent(exports.ElementEvent.UNMOUNTED);
|
|
24505
|
-
_this.beforeRenderEvent = new CustomEvent(exports.CanvasEvent.BEFORE_RENDER);
|
|
24506
|
-
_this.afterRenderEvent = new CustomEvent(exports.CanvasEvent.AFTER_RENDER);
|
|
24507
24649
|
_this.context = {};
|
|
24508
24650
|
_this.document = new Document();
|
|
24509
24651
|
_this.document.defaultView = _assertThisInitialized(_this); // create registry of custom elements
|
|
@@ -24608,8 +24750,6 @@
|
|
|
24608
24750
|
var _proto = Canvas.prototype;
|
|
24609
24751
|
|
|
24610
24752
|
_proto.initRenderingContext = function initRenderingContext(mergedConfig) {
|
|
24611
|
-
var _this2 = this;
|
|
24612
|
-
|
|
24613
24753
|
this.context.config = mergedConfig; // bind rendering context, shared by all renderers
|
|
24614
24754
|
|
|
24615
24755
|
this.context.renderingContext = {
|
|
@@ -24623,16 +24763,10 @@
|
|
|
24623
24763
|
force: false,
|
|
24624
24764
|
dirty: false
|
|
24625
24765
|
};
|
|
24626
|
-
this.document.documentElement.addEventListener(exports.ElementEvent.CHILD_INSERTED, function (e) {
|
|
24627
|
-
_this2.mountChildren(e.detail.child);
|
|
24628
|
-
});
|
|
24629
|
-
this.document.documentElement.addEventListener(exports.ElementEvent.CHILD_REMOVED, function (e) {
|
|
24630
|
-
_this2.unmountChildren(e.detail.child);
|
|
24631
|
-
});
|
|
24632
24766
|
};
|
|
24633
24767
|
|
|
24634
24768
|
_proto.initDefaultCamera = function initDefaultCamera(width, height) {
|
|
24635
|
-
var
|
|
24769
|
+
var _this2 = this;
|
|
24636
24770
|
|
|
24637
24771
|
// set a default ortho camera
|
|
24638
24772
|
var camera = new runtime.CameraContribution();
|
|
@@ -24641,7 +24775,7 @@
|
|
|
24641
24775
|
camera.canvas = this; // redraw when camera changed
|
|
24642
24776
|
|
|
24643
24777
|
camera.eventEmitter.on(CameraEvent.UPDATED, function () {
|
|
24644
|
-
|
|
24778
|
+
_this2.context.renderingContext.renderReasons.add(exports.RenderReason.CAMERA_CHANGED);
|
|
24645
24779
|
}); // bind camera
|
|
24646
24780
|
|
|
24647
24781
|
this.context.camera = camera;
|
|
@@ -24785,19 +24919,19 @@
|
|
|
24785
24919
|
};
|
|
24786
24920
|
|
|
24787
24921
|
_proto.render = function render() {
|
|
24788
|
-
this.dispatchEvent(
|
|
24922
|
+
this.dispatchEvent(beforeRenderEvent);
|
|
24789
24923
|
var renderingService = this.getRenderingService();
|
|
24790
24924
|
renderingService.render(this.getConfig());
|
|
24791
|
-
this.dispatchEvent(
|
|
24925
|
+
this.dispatchEvent(afterRenderEvent);
|
|
24792
24926
|
};
|
|
24793
24927
|
|
|
24794
24928
|
_proto.run = function run() {
|
|
24795
|
-
var
|
|
24929
|
+
var _this3 = this;
|
|
24796
24930
|
|
|
24797
24931
|
var tick = function tick() {
|
|
24798
|
-
|
|
24932
|
+
_this3.render();
|
|
24799
24933
|
|
|
24800
|
-
|
|
24934
|
+
_this3.frameId = requestAnimationFrame(tick);
|
|
24801
24935
|
};
|
|
24802
24936
|
|
|
24803
24937
|
tick();
|
|
@@ -24875,12 +25009,12 @@
|
|
|
24875
25009
|
}();
|
|
24876
25010
|
|
|
24877
25011
|
_proto.loadRendererContainerModule = function loadRendererContainerModule(renderer) {
|
|
24878
|
-
var
|
|
25012
|
+
var _this4 = this;
|
|
24879
25013
|
|
|
24880
25014
|
// load other container modules provided by g-canvas/g-svg/g-webgl
|
|
24881
25015
|
var plugins = renderer.getPlugins();
|
|
24882
25016
|
plugins.forEach(function (plugin) {
|
|
24883
|
-
plugin.context =
|
|
25017
|
+
plugin.context = _this4.context;
|
|
24884
25018
|
plugin.init();
|
|
24885
25019
|
});
|
|
24886
25020
|
};
|
|
@@ -24936,7 +25070,7 @@
|
|
|
24936
25070
|
};
|
|
24937
25071
|
|
|
24938
25072
|
_proto.unmountChildren = function unmountChildren(parent) {
|
|
24939
|
-
var
|
|
25073
|
+
var _this5 = this;
|
|
24940
25074
|
|
|
24941
25075
|
if (this.inited) {
|
|
24942
25076
|
var path = [];
|
|
@@ -24948,15 +25082,22 @@
|
|
|
24948
25082
|
|
|
24949
25083
|
path.reverse().forEach(function (child) {
|
|
24950
25084
|
// trigger before unmounted
|
|
24951
|
-
if (child
|
|
25085
|
+
if (child.isCustomElement) {
|
|
24952
25086
|
if (child.disconnectedCallback) {
|
|
24953
25087
|
child.disconnectedCallback();
|
|
24954
25088
|
}
|
|
24955
25089
|
}
|
|
24956
25090
|
|
|
24957
|
-
child.
|
|
25091
|
+
if (child.isMutationObserved) {
|
|
25092
|
+
child.dispatchEvent(unmountedEvent);
|
|
25093
|
+
} else {
|
|
25094
|
+
unmountedEvent.target = child;
|
|
25095
|
+
|
|
25096
|
+
_this5.dispatchEvent(unmountedEvent, true);
|
|
25097
|
+
} // skip document.documentElement
|
|
24958
25098
|
|
|
24959
|
-
|
|
25099
|
+
|
|
25100
|
+
if (child !== _this5.document.documentElement) {
|
|
24960
25101
|
child.ownerDocument = null;
|
|
24961
25102
|
}
|
|
24962
25103
|
|
|
@@ -24966,16 +25107,24 @@
|
|
|
24966
25107
|
};
|
|
24967
25108
|
|
|
24968
25109
|
_proto.mountChildren = function mountChildren(parent) {
|
|
24969
|
-
var
|
|
25110
|
+
var _this6 = this;
|
|
24970
25111
|
|
|
24971
25112
|
if (this.inited) {
|
|
24972
25113
|
parent.forEach(function (child) {
|
|
24973
25114
|
if (!child.isConnected) {
|
|
24974
|
-
child.ownerDocument =
|
|
25115
|
+
child.ownerDocument = _this6.document;
|
|
24975
25116
|
child.isConnected = true;
|
|
24976
|
-
child.dispatchEvent(_this7.mountEvent); // trigger after mounted
|
|
24977
25117
|
|
|
24978
|
-
if (child
|
|
25118
|
+
if (child.isMutationObserved) {
|
|
25119
|
+
child.dispatchEvent(mountedEvent);
|
|
25120
|
+
} else {
|
|
25121
|
+
mountedEvent.target = child;
|
|
25122
|
+
|
|
25123
|
+
_this6.dispatchEvent(mountedEvent, true);
|
|
25124
|
+
} // trigger after mounted
|
|
25125
|
+
|
|
25126
|
+
|
|
25127
|
+
if (child.isCustomElement) {
|
|
24979
25128
|
if (child.connectedCallback) {
|
|
24980
25129
|
child.connectedCallback();
|
|
24981
25130
|
}
|
|
@@ -25030,12 +25179,12 @@
|
|
|
25030
25179
|
_createClass(Canvas, [{
|
|
25031
25180
|
key: "ready",
|
|
25032
25181
|
get: function get() {
|
|
25033
|
-
var
|
|
25182
|
+
var _this7 = this;
|
|
25034
25183
|
|
|
25035
25184
|
if (!this.readyPromise) {
|
|
25036
25185
|
this.readyPromise = new Promise(function (resolve) {
|
|
25037
|
-
|
|
25038
|
-
resolve(
|
|
25186
|
+
_this7.resolveReadyPromise = function () {
|
|
25187
|
+
resolve(_this7);
|
|
25039
25188
|
};
|
|
25040
25189
|
});
|
|
25041
25190
|
|