@antv/g-lite 1.0.11 → 1.0.12
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.map +1 -1
- package/dist/display-objects/DisplayObject.d.ts +69 -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/dom/Element.d.ts.map +1 -1
- package/dist/dom/interfaces.d.ts +2 -8
- package/dist/dom/interfaces.d.ts.map +1 -1
- package/dist/index.esm.js +231 -127
- package/dist/index.js +231 -127
- package/dist/index.umd.js +231 -127
- package/dist/index.umd.min.js +2 -2
- package/dist/shapes/AABB.d.ts +1 -1
- package/dist/shapes/AABB.d.ts.map +1 -1
- package/dist/utils/text.d.ts.map +1 -1
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -104,6 +104,14 @@ var AABB = /*#__PURE__*/function () {
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
function AABB(center, halfExtents) {
|
|
107
|
+
if (center === void 0) {
|
|
108
|
+
center = [0, 0, 0];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (halfExtents === void 0) {
|
|
112
|
+
halfExtents = [0, 0, 0];
|
|
113
|
+
}
|
|
114
|
+
|
|
107
115
|
this.center = glMatrix.vec3.create();
|
|
108
116
|
this.halfExtents = glMatrix.vec3.create();
|
|
109
117
|
this.min = glMatrix.vec3.create();
|
|
@@ -114,16 +122,10 @@ var AABB = /*#__PURE__*/function () {
|
|
|
114
122
|
var _proto = AABB.prototype;
|
|
115
123
|
|
|
116
124
|
_proto.update = function update(center, halfExtents) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (halfExtents) {
|
|
122
|
-
glMatrix.vec3.copy(this.halfExtents, halfExtents || glMatrix.vec3.fromValues(0, 0, 0));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
this.min = glMatrix.vec3.sub(this.min, this.center, this.halfExtents);
|
|
126
|
-
this.max = glMatrix.vec3.add(this.max, this.center, this.halfExtents);
|
|
125
|
+
glMatrix.vec3.copy(this.center, center);
|
|
126
|
+
glMatrix.vec3.copy(this.halfExtents, halfExtents);
|
|
127
|
+
glMatrix.vec3.sub(this.min, this.center, this.halfExtents);
|
|
128
|
+
glMatrix.vec3.add(this.max, this.center, this.halfExtents);
|
|
127
129
|
};
|
|
128
130
|
|
|
129
131
|
_proto.setMinMax = function setMinMax(min, max) {
|
|
@@ -8060,6 +8062,7 @@ var SyncWaterfallHook = /*#__PURE__*/function (_SyncHook) {
|
|
|
8060
8062
|
// SyncWaterfallHook.prototype = null;
|
|
8061
8063
|
|
|
8062
8064
|
var genericFontFamilies = ['serif', 'sans-serif', 'monospace', 'cursive', 'fantasy', 'system-ui'];
|
|
8065
|
+
var stringRegExp = /([\"\'])[^\'\"]+\1/;
|
|
8063
8066
|
function toFontString(attributes) {
|
|
8064
8067
|
var fontSize = attributes.fontSize,
|
|
8065
8068
|
fontFamily = attributes.fontFamily,
|
|
@@ -8079,7 +8082,7 @@ function toFontString(attributes) {
|
|
|
8079
8082
|
var _fontFamily = fontFamilies[i].trim(); // Check if font already contains strings
|
|
8080
8083
|
|
|
8081
8084
|
|
|
8082
|
-
if (
|
|
8085
|
+
if (!stringRegExp.test(_fontFamily) && genericFontFamilies.indexOf(_fontFamily) < 0) {
|
|
8083
8086
|
_fontFamily = "\"" + _fontFamily + "\"";
|
|
8084
8087
|
}
|
|
8085
8088
|
|
|
@@ -8584,7 +8587,7 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
8584
8587
|
d: '0'
|
|
8585
8588
|
}];
|
|
8586
8589
|
var propertyMetadataCache = {};
|
|
8587
|
-
var unresolvedProperties =
|
|
8590
|
+
var unresolvedProperties = new WeakMap();
|
|
8588
8591
|
var priorityMap = {};
|
|
8589
8592
|
var sortAttributeNames = util.memoize(function (attributeNames) {
|
|
8590
8593
|
return attributeNames.sort(function (a, b) {
|
|
@@ -8596,11 +8599,13 @@ var tmpVec3b = glMatrix.vec3.create();
|
|
|
8596
8599
|
var tmpVec3c = glMatrix.vec3.create();
|
|
8597
8600
|
|
|
8598
8601
|
var isPropertyResolved = function isPropertyResolved(object, name) {
|
|
8599
|
-
|
|
8602
|
+
var properties = unresolvedProperties.get(object);
|
|
8603
|
+
|
|
8604
|
+
if (!properties || properties.length === 0) {
|
|
8600
8605
|
return true;
|
|
8601
8606
|
}
|
|
8602
8607
|
|
|
8603
|
-
return
|
|
8608
|
+
return properties.includes(name);
|
|
8604
8609
|
};
|
|
8605
8610
|
|
|
8606
8611
|
var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
@@ -8846,12 +8851,15 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
8846
8851
|
;
|
|
8847
8852
|
|
|
8848
8853
|
_proto.addUnresolveProperty = function addUnresolveProperty(object, name) {
|
|
8849
|
-
|
|
8850
|
-
|
|
8854
|
+
var properties = unresolvedProperties.get(object);
|
|
8855
|
+
|
|
8856
|
+
if (!properties) {
|
|
8857
|
+
unresolvedProperties.set(object, []);
|
|
8858
|
+
properties = unresolvedProperties.get(object);
|
|
8851
8859
|
}
|
|
8852
8860
|
|
|
8853
|
-
if (
|
|
8854
|
-
|
|
8861
|
+
if (properties.indexOf(name) === -1) {
|
|
8862
|
+
properties.push(name);
|
|
8855
8863
|
}
|
|
8856
8864
|
};
|
|
8857
8865
|
|
|
@@ -8887,7 +8895,7 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
8887
8895
|
};
|
|
8888
8896
|
|
|
8889
8897
|
_proto.recalc = function recalc(object) {
|
|
8890
|
-
var properties = unresolvedProperties
|
|
8898
|
+
var properties = unresolvedProperties.get(object);
|
|
8891
8899
|
|
|
8892
8900
|
if (properties && properties.length) {
|
|
8893
8901
|
var attributes = {};
|
|
@@ -8895,7 +8903,7 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
8895
8903
|
attributes[property] = object.attributes[property];
|
|
8896
8904
|
});
|
|
8897
8905
|
this.processProperties(object, attributes);
|
|
8898
|
-
delete
|
|
8906
|
+
unresolvedProperties.delete(object);
|
|
8899
8907
|
}
|
|
8900
8908
|
}
|
|
8901
8909
|
/**
|
|
@@ -10263,22 +10271,12 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
10263
10271
|
*/
|
|
10264
10272
|
|
|
10265
10273
|
ElementEvent["INSERTED"] = "DOMNodeInserted";
|
|
10266
|
-
/**
|
|
10267
|
-
* it has had a child inserted
|
|
10268
|
-
*/
|
|
10269
|
-
|
|
10270
|
-
ElementEvent["CHILD_INSERTED"] = "child-inserted";
|
|
10271
10274
|
/**
|
|
10272
10275
|
* it is being removed
|
|
10273
10276
|
* @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeRemoved
|
|
10274
10277
|
*/
|
|
10275
10278
|
|
|
10276
10279
|
ElementEvent["REMOVED"] = "removed";
|
|
10277
|
-
/**
|
|
10278
|
-
* it has had a child removed
|
|
10279
|
-
*/
|
|
10280
|
-
|
|
10281
|
-
ElementEvent["CHILD_REMOVED"] = "child-removed";
|
|
10282
10280
|
/**
|
|
10283
10281
|
* @see https://www.w3.org/TR/DOM-Level-3-Events/#domnodeinsertedintodocument
|
|
10284
10282
|
*/
|
|
@@ -10333,17 +10331,10 @@ MutationEvent.REMOVAL = 3;
|
|
|
10333
10331
|
var entityCounter = 0;
|
|
10334
10332
|
function resetEntityCounter() {
|
|
10335
10333
|
entityCounter = 0;
|
|
10336
|
-
}
|
|
10337
|
-
|
|
10338
|
-
var childInsertedEvent = new CustomEvent(exports.ElementEvent.CHILD_INSERTED, {
|
|
10339
|
-
child: null
|
|
10340
|
-
});
|
|
10334
|
+
}
|
|
10341
10335
|
var insertedEvent = new MutationEvent(exports.ElementEvent.INSERTED, null, '', '', '', 0, '', '');
|
|
10342
10336
|
var removedEvent = new MutationEvent(exports.ElementEvent.REMOVED, null, '', '', '', 0, '', '');
|
|
10343
10337
|
var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
|
|
10344
|
-
var childRemovedEvent = new CustomEvent(exports.ElementEvent.CHILD_REMOVED, {
|
|
10345
|
-
child: null
|
|
10346
|
-
});
|
|
10347
10338
|
/**
|
|
10348
10339
|
* Has following capabilities:
|
|
10349
10340
|
* * Node insert/remove, eg. appendChild, removeChild, remove...
|
|
@@ -10481,19 +10472,13 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
10481
10472
|
};
|
|
10482
10473
|
|
|
10483
10474
|
_proto.appendChild = function appendChild(child, index) {
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
// this.ownerDocument?.defaultView?.mountChildren(child);
|
|
10492
|
-
|
|
10493
|
-
this.dispatchEvent(childInsertedEvent); // child.emit(ElementEvent.INSERTED, {
|
|
10494
|
-
// parent: this,
|
|
10495
|
-
// index,
|
|
10496
|
-
// });
|
|
10475
|
+
var _this$ownerDocument;
|
|
10476
|
+
|
|
10477
|
+
runtime.sceneGraphService.attach(child, this, index);
|
|
10478
|
+
|
|
10479
|
+
if ((_this$ownerDocument = this.ownerDocument) === null || _this$ownerDocument === void 0 ? void 0 : _this$ownerDocument.defaultView) {
|
|
10480
|
+
this.ownerDocument.defaultView.mountChildren(child);
|
|
10481
|
+
}
|
|
10497
10482
|
|
|
10498
10483
|
insertedEvent.relatedNode = this;
|
|
10499
10484
|
child.dispatchEvent(insertedEvent);
|
|
@@ -10519,36 +10504,18 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
10519
10504
|
};
|
|
10520
10505
|
|
|
10521
10506
|
_proto.removeChild = function removeChild(child) {
|
|
10507
|
+
var _child$ownerDocument;
|
|
10508
|
+
|
|
10522
10509
|
// should emit on itself before detach
|
|
10523
|
-
// child.emit(ElementEvent.REMOVED, {
|
|
10524
|
-
// parent: this,
|
|
10525
|
-
// });
|
|
10526
10510
|
removedEvent.relatedNode = this;
|
|
10527
|
-
child.dispatchEvent(removedEvent);
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
//
|
|
10532
|
-
// }
|
|
10533
|
-
// emit on parent
|
|
10534
|
-
|
|
10535
|
-
childRemovedEvent.detail.child = child;
|
|
10536
|
-
this.dispatchEvent(childRemovedEvent); // this.dispatchEvent(
|
|
10537
|
-
// new CustomEvent(ElementEvent.CHILD_REMOVED, {
|
|
10538
|
-
// child,
|
|
10539
|
-
// }),
|
|
10540
|
-
// );
|
|
10541
|
-
// remove from scene graph
|
|
10542
|
-
|
|
10543
|
-
runtime.sceneGraphService.detach(child); // cannot emit Destroy event now
|
|
10544
|
-
// if (destroy) {
|
|
10545
|
-
// // this.removeChildren();
|
|
10546
|
-
// // remove event listeners
|
|
10547
|
-
// // @ts-ignore
|
|
10548
|
-
// child.emitter.removeAllListeners();
|
|
10549
|
-
// displayObjectPool.remove((child as unknown as Element).entity);
|
|
10550
|
-
// }
|
|
10511
|
+
child.dispatchEvent(removedEvent);
|
|
10512
|
+
|
|
10513
|
+
if ((_child$ownerDocument = child.ownerDocument) === null || _child$ownerDocument === void 0 ? void 0 : _child$ownerDocument.defaultView) {
|
|
10514
|
+
child.ownerDocument.defaultView.unmountChildren(child);
|
|
10515
|
+
} // remove from scene graph
|
|
10551
10516
|
|
|
10517
|
+
|
|
10518
|
+
runtime.sceneGraphService.detach(child);
|
|
10552
10519
|
return child;
|
|
10553
10520
|
}
|
|
10554
10521
|
/**
|
|
@@ -10841,14 +10808,15 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
10841
10808
|
var value = this.attributes[name];
|
|
10842
10809
|
|
|
10843
10810
|
if (value === undefined) {
|
|
10844
|
-
var _formatAttribute = formatAttribute(name
|
|
10811
|
+
var _formatAttribute = formatAttribute(name, ''),
|
|
10845
10812
|
attributeName = _formatAttribute[0];
|
|
10846
10813
|
|
|
10847
|
-
value = this.attributes[attributeName];
|
|
10848
|
-
} // if the given attribute does not exist, the value returned will either be null or ""
|
|
10849
|
-
|
|
10814
|
+
value = this.attributes[attributeName]; // if the given attribute does not exist, the value returned will either be null or ""
|
|
10850
10815
|
|
|
10851
|
-
|
|
10816
|
+
return util.isNil(value) ? null : value;
|
|
10817
|
+
} else {
|
|
10818
|
+
return value;
|
|
10819
|
+
}
|
|
10852
10820
|
}
|
|
10853
10821
|
/**
|
|
10854
10822
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
|
|
@@ -11291,6 +11259,11 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11291
11259
|
_this.config = void 0;
|
|
11292
11260
|
_this.isCustomElement = false;
|
|
11293
11261
|
_this.activeAnimations = [];
|
|
11262
|
+
|
|
11263
|
+
_this.getClip = function () {
|
|
11264
|
+
return this.style.clipPath || null;
|
|
11265
|
+
};
|
|
11266
|
+
|
|
11294
11267
|
_this.config = config; // compatible with G 3.0
|
|
11295
11268
|
|
|
11296
11269
|
_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
|
|
@@ -11663,10 +11636,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11663
11636
|
;
|
|
11664
11637
|
|
|
11665
11638
|
_proto.getEulerAngles = function getEulerAngles() {
|
|
11666
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11667
11639
|
var _getEuler = getEuler(glMatrix.vec3.create(), runtime.sceneGraphService.getWorldTransform(this)),
|
|
11668
|
-
ex = _getEuler[0],
|
|
11669
|
-
ey = _getEuler[1],
|
|
11670
11640
|
ez = _getEuler[2];
|
|
11671
11641
|
|
|
11672
11642
|
return rad2deg(ez);
|
|
@@ -11677,10 +11647,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11677
11647
|
;
|
|
11678
11648
|
|
|
11679
11649
|
_proto.getLocalEulerAngles = function getLocalEulerAngles() {
|
|
11680
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11681
11650
|
var _getEuler2 = getEuler(glMatrix.vec3.create(), runtime.sceneGraphService.getLocalRotation(this)),
|
|
11682
|
-
ex = _getEuler2[0],
|
|
11683
|
-
ey = _getEuler2[1],
|
|
11684
11651
|
ez = _getEuler2[2];
|
|
11685
11652
|
|
|
11686
11653
|
return rad2deg(ez);
|
|
@@ -11907,11 +11874,10 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11907
11874
|
sx = _mat4$getScaling[0],
|
|
11908
11875
|
sy = _mat4$getScaling[1];
|
|
11909
11876
|
|
|
11910
|
-
var rotation = glMatrix.mat4.getRotation(glMatrix.quat.create(), transform);
|
|
11877
|
+
var rotation = glMatrix.mat4.getRotation(glMatrix.quat.create(), transform);
|
|
11911
11878
|
|
|
11912
11879
|
var _getEuler3 = getEuler(glMatrix.vec3.create(), rotation),
|
|
11913
11880
|
eux = _getEuler3[0],
|
|
11914
|
-
euy = _getEuler3[1],
|
|
11915
11881
|
euz = _getEuler3[2]; // gimbal lock at 90 degrees
|
|
11916
11882
|
|
|
11917
11883
|
|
|
@@ -11975,6 +11941,145 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11975
11941
|
|
|
11976
11942
|
_proto.hide = function hide() {
|
|
11977
11943
|
this.style.visibility = 'hidden';
|
|
11944
|
+
}
|
|
11945
|
+
/**
|
|
11946
|
+
* Use `childElementCount` instead.
|
|
11947
|
+
* @deprecated
|
|
11948
|
+
*/
|
|
11949
|
+
;
|
|
11950
|
+
|
|
11951
|
+
_proto.getCount = function getCount() {
|
|
11952
|
+
return this.childElementCount;
|
|
11953
|
+
}
|
|
11954
|
+
/**
|
|
11955
|
+
* Use `parentElement` instead.
|
|
11956
|
+
* @deprecated
|
|
11957
|
+
*/
|
|
11958
|
+
;
|
|
11959
|
+
|
|
11960
|
+
_proto.getParent = function getParent() {
|
|
11961
|
+
return this.parentElement;
|
|
11962
|
+
}
|
|
11963
|
+
/**
|
|
11964
|
+
* Use `children` instead.
|
|
11965
|
+
* @deprecated
|
|
11966
|
+
*/
|
|
11967
|
+
;
|
|
11968
|
+
|
|
11969
|
+
_proto.getChildren = function getChildren() {
|
|
11970
|
+
return this.children;
|
|
11971
|
+
}
|
|
11972
|
+
/**
|
|
11973
|
+
* Use `firstElementChild` instead.
|
|
11974
|
+
* @deprecated
|
|
11975
|
+
*/
|
|
11976
|
+
;
|
|
11977
|
+
|
|
11978
|
+
_proto.getFirst = function getFirst() {
|
|
11979
|
+
return this.firstElementChild;
|
|
11980
|
+
}
|
|
11981
|
+
/**
|
|
11982
|
+
* Use `lastElementChild` instead.
|
|
11983
|
+
* @deprecated
|
|
11984
|
+
*/
|
|
11985
|
+
;
|
|
11986
|
+
|
|
11987
|
+
_proto.getLast = function getLast() {
|
|
11988
|
+
return this.lastElementChild;
|
|
11989
|
+
}
|
|
11990
|
+
/**
|
|
11991
|
+
* Use `this.children[index]` instead.
|
|
11992
|
+
* @deprecated
|
|
11993
|
+
*/
|
|
11994
|
+
;
|
|
11995
|
+
|
|
11996
|
+
_proto.getChildByIndex = function getChildByIndex(index) {
|
|
11997
|
+
return this.children[index] || null;
|
|
11998
|
+
}
|
|
11999
|
+
/**
|
|
12000
|
+
* Use `appendChild` instead.
|
|
12001
|
+
* @deprecated
|
|
12002
|
+
*/
|
|
12003
|
+
;
|
|
12004
|
+
|
|
12005
|
+
_proto.add = function add(child, index) {
|
|
12006
|
+
return this.appendChild(child, index);
|
|
12007
|
+
}
|
|
12008
|
+
/**
|
|
12009
|
+
* Use `this.style.clipPath` instead.
|
|
12010
|
+
* @deprecated
|
|
12011
|
+
*/
|
|
12012
|
+
;
|
|
12013
|
+
|
|
12014
|
+
_proto.setClip = function setClip(clipPath) {
|
|
12015
|
+
this.style.clipPath = clipPath;
|
|
12016
|
+
}
|
|
12017
|
+
/**
|
|
12018
|
+
* Use `this.style.clipPath` instead.
|
|
12019
|
+
* @deprecated
|
|
12020
|
+
*/
|
|
12021
|
+
;
|
|
12022
|
+
|
|
12023
|
+
/**
|
|
12024
|
+
* @deprecated
|
|
12025
|
+
*/
|
|
12026
|
+
_proto.set = function set(name, value) {
|
|
12027
|
+
// @ts-ignore
|
|
12028
|
+
this.config[name] = value;
|
|
12029
|
+
}
|
|
12030
|
+
/**
|
|
12031
|
+
* @deprecated
|
|
12032
|
+
*/
|
|
12033
|
+
;
|
|
12034
|
+
|
|
12035
|
+
_proto.get = function get(name) {
|
|
12036
|
+
return this.config[name];
|
|
12037
|
+
}
|
|
12038
|
+
/**
|
|
12039
|
+
* Use `setPosition` instead.
|
|
12040
|
+
* @deprecated
|
|
12041
|
+
*/
|
|
12042
|
+
;
|
|
12043
|
+
|
|
12044
|
+
_proto.moveTo = function moveTo(position, y, z) {
|
|
12045
|
+
if (y === void 0) {
|
|
12046
|
+
y = 0;
|
|
12047
|
+
}
|
|
12048
|
+
|
|
12049
|
+
if (z === void 0) {
|
|
12050
|
+
z = 0;
|
|
12051
|
+
}
|
|
12052
|
+
|
|
12053
|
+
this.setPosition(position, y, z);
|
|
12054
|
+
return this;
|
|
12055
|
+
}
|
|
12056
|
+
/**
|
|
12057
|
+
* Use `setPosition` instead.
|
|
12058
|
+
* @deprecated
|
|
12059
|
+
*/
|
|
12060
|
+
;
|
|
12061
|
+
|
|
12062
|
+
_proto.move = function move(position, y, z) {
|
|
12063
|
+
if (y === void 0) {
|
|
12064
|
+
y = 0;
|
|
12065
|
+
}
|
|
12066
|
+
|
|
12067
|
+
if (z === void 0) {
|
|
12068
|
+
z = 0;
|
|
12069
|
+
}
|
|
12070
|
+
|
|
12071
|
+
this.setPosition(position, y, z);
|
|
12072
|
+
return this;
|
|
12073
|
+
}
|
|
12074
|
+
/**
|
|
12075
|
+
* Use `this.style.zIndex` instead.
|
|
12076
|
+
* @deprecated
|
|
12077
|
+
*/
|
|
12078
|
+
;
|
|
12079
|
+
|
|
12080
|
+
_proto.setZIndex = function setZIndex(zIndex) {
|
|
12081
|
+
this.style.zIndex = zIndex;
|
|
12082
|
+
return this;
|
|
11978
12083
|
};
|
|
11979
12084
|
|
|
11980
12085
|
_createClass(DisplayObject, [{
|
|
@@ -13430,18 +13535,25 @@ var Camera = /*#__PURE__*/function () {
|
|
|
13430
13535
|
ox = _this$canvas$viewport.x,
|
|
13431
13536
|
oy = _this$canvas$viewport.y;
|
|
13432
13537
|
|
|
13538
|
+
var roll = this.roll;
|
|
13539
|
+
this.rotate(0, 0, -roll);
|
|
13433
13540
|
this.setPosition(ox, oy);
|
|
13434
13541
|
this.setFocalPoint(ox, oy);
|
|
13435
13542
|
this.setZoom(zoom);
|
|
13543
|
+
this.rotate(0, 0, roll);
|
|
13436
13544
|
|
|
13437
13545
|
var _this$canvas$viewport2 = this.canvas.viewport2Canvas({
|
|
13438
13546
|
x: viewportPoint[0],
|
|
13439
13547
|
y: viewportPoint[1]
|
|
13440
13548
|
}),
|
|
13441
13549
|
cx = _this$canvas$viewport2.x,
|
|
13442
|
-
cy = _this$canvas$viewport2.y;
|
|
13550
|
+
cy = _this$canvas$viewport2.y; // project to rotated axis
|
|
13551
|
+
|
|
13443
13552
|
|
|
13444
|
-
|
|
13553
|
+
var dvec = glMatrix.vec3.fromValues(cx - ox, cy - oy, 0);
|
|
13554
|
+
var dx = glMatrix.vec3.dot(dvec, this.right) / glMatrix.vec3.length(this.right);
|
|
13555
|
+
var dy = glMatrix.vec3.dot(dvec, this.up) / glMatrix.vec3.length(this.up);
|
|
13556
|
+
this.pan(-dx, -dy);
|
|
13445
13557
|
return this;
|
|
13446
13558
|
};
|
|
13447
13559
|
|
|
@@ -17970,6 +18082,14 @@ PrepareRendererPlugin.tag = 'Prepare';
|
|
|
17970
18082
|
var DEFAULT_CAMERA_Z = 500;
|
|
17971
18083
|
var DEFAULT_CAMERA_NEAR = 0.1;
|
|
17972
18084
|
var DEFAULT_CAMERA_FAR = 1000;
|
|
18085
|
+
/**
|
|
18086
|
+
* reuse custom event preventing from re-create them in every frame
|
|
18087
|
+
*/
|
|
18088
|
+
|
|
18089
|
+
var mountEvent = new CustomEvent(exports.ElementEvent.MOUNTED);
|
|
18090
|
+
var unmountEvent = new CustomEvent(exports.ElementEvent.UNMOUNTED);
|
|
18091
|
+
var beforeRenderEvent = new CustomEvent(exports.CanvasEvent.BEFORE_RENDER);
|
|
18092
|
+
var afterRenderEvent = new CustomEvent(exports.CanvasEvent.AFTER_RENDER);
|
|
17973
18093
|
/**
|
|
17974
18094
|
* can be treated like Window in DOM
|
|
17975
18095
|
* provide some extra methods like `window`, such as:
|
|
@@ -18027,10 +18147,6 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18027
18147
|
/**
|
|
18028
18148
|
* rAF in auto rendering
|
|
18029
18149
|
*/
|
|
18030
|
-
|
|
18031
|
-
/**
|
|
18032
|
-
* reuse custom event preventing from re-create them in every frame
|
|
18033
|
-
*/
|
|
18034
18150
|
function Canvas(config) {
|
|
18035
18151
|
var _this;
|
|
18036
18152
|
|
|
@@ -18050,10 +18166,6 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18050
18166
|
_this.inited = false;
|
|
18051
18167
|
_this.readyPromise = void 0;
|
|
18052
18168
|
_this.resolveReadyPromise = void 0;
|
|
18053
|
-
_this.mountEvent = new CustomEvent(exports.ElementEvent.MOUNTED);
|
|
18054
|
-
_this.unmountEvent = new CustomEvent(exports.ElementEvent.UNMOUNTED);
|
|
18055
|
-
_this.beforeRenderEvent = new CustomEvent(exports.CanvasEvent.BEFORE_RENDER);
|
|
18056
|
-
_this.afterRenderEvent = new CustomEvent(exports.CanvasEvent.AFTER_RENDER);
|
|
18057
18169
|
_this.context = {};
|
|
18058
18170
|
_this.document = new Document();
|
|
18059
18171
|
_this.document.defaultView = _assertThisInitialized(_this); // create registry of custom elements
|
|
@@ -18158,8 +18270,6 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18158
18270
|
var _proto = Canvas.prototype;
|
|
18159
18271
|
|
|
18160
18272
|
_proto.initRenderingContext = function initRenderingContext(mergedConfig) {
|
|
18161
|
-
var _this2 = this;
|
|
18162
|
-
|
|
18163
18273
|
this.context.config = mergedConfig; // bind rendering context, shared by all renderers
|
|
18164
18274
|
|
|
18165
18275
|
this.context.renderingContext = {
|
|
@@ -18173,16 +18283,10 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18173
18283
|
force: false,
|
|
18174
18284
|
dirty: false
|
|
18175
18285
|
};
|
|
18176
|
-
this.document.documentElement.addEventListener(exports.ElementEvent.CHILD_INSERTED, function (e) {
|
|
18177
|
-
_this2.mountChildren(e.detail.child);
|
|
18178
|
-
});
|
|
18179
|
-
this.document.documentElement.addEventListener(exports.ElementEvent.CHILD_REMOVED, function (e) {
|
|
18180
|
-
_this2.unmountChildren(e.detail.child);
|
|
18181
|
-
});
|
|
18182
18286
|
};
|
|
18183
18287
|
|
|
18184
18288
|
_proto.initDefaultCamera = function initDefaultCamera(width, height) {
|
|
18185
|
-
var
|
|
18289
|
+
var _this2 = this;
|
|
18186
18290
|
|
|
18187
18291
|
// set a default ortho camera
|
|
18188
18292
|
var camera = new runtime.CameraContribution();
|
|
@@ -18191,7 +18295,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18191
18295
|
camera.canvas = this; // redraw when camera changed
|
|
18192
18296
|
|
|
18193
18297
|
camera.eventEmitter.on(CameraEvent.UPDATED, function () {
|
|
18194
|
-
|
|
18298
|
+
_this2.context.renderingContext.renderReasons.add(exports.RenderReason.CAMERA_CHANGED);
|
|
18195
18299
|
}); // bind camera
|
|
18196
18300
|
|
|
18197
18301
|
this.context.camera = camera;
|
|
@@ -18335,19 +18439,19 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18335
18439
|
};
|
|
18336
18440
|
|
|
18337
18441
|
_proto.render = function render() {
|
|
18338
|
-
this.dispatchEvent(
|
|
18442
|
+
this.dispatchEvent(beforeRenderEvent);
|
|
18339
18443
|
var renderingService = this.getRenderingService();
|
|
18340
18444
|
renderingService.render(this.getConfig());
|
|
18341
|
-
this.dispatchEvent(
|
|
18445
|
+
this.dispatchEvent(afterRenderEvent);
|
|
18342
18446
|
};
|
|
18343
18447
|
|
|
18344
18448
|
_proto.run = function run() {
|
|
18345
|
-
var
|
|
18449
|
+
var _this3 = this;
|
|
18346
18450
|
|
|
18347
18451
|
var tick = function tick() {
|
|
18348
|
-
|
|
18452
|
+
_this3.render();
|
|
18349
18453
|
|
|
18350
|
-
|
|
18454
|
+
_this3.frameId = requestAnimationFrame(tick);
|
|
18351
18455
|
};
|
|
18352
18456
|
|
|
18353
18457
|
tick();
|
|
@@ -18425,12 +18529,12 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18425
18529
|
}();
|
|
18426
18530
|
|
|
18427
18531
|
_proto.loadRendererContainerModule = function loadRendererContainerModule(renderer) {
|
|
18428
|
-
var
|
|
18532
|
+
var _this4 = this;
|
|
18429
18533
|
|
|
18430
18534
|
// load other container modules provided by g-canvas/g-svg/g-webgl
|
|
18431
18535
|
var plugins = renderer.getPlugins();
|
|
18432
18536
|
plugins.forEach(function (plugin) {
|
|
18433
|
-
plugin.context =
|
|
18537
|
+
plugin.context = _this4.context;
|
|
18434
18538
|
plugin.init();
|
|
18435
18539
|
});
|
|
18436
18540
|
};
|
|
@@ -18486,7 +18590,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18486
18590
|
};
|
|
18487
18591
|
|
|
18488
18592
|
_proto.unmountChildren = function unmountChildren(parent) {
|
|
18489
|
-
var
|
|
18593
|
+
var _this5 = this;
|
|
18490
18594
|
|
|
18491
18595
|
if (this.inited) {
|
|
18492
18596
|
var path = [];
|
|
@@ -18504,9 +18608,9 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18504
18608
|
}
|
|
18505
18609
|
}
|
|
18506
18610
|
|
|
18507
|
-
child.dispatchEvent(
|
|
18611
|
+
child.dispatchEvent(unmountEvent); // skip document.documentElement
|
|
18508
18612
|
|
|
18509
|
-
if (child !==
|
|
18613
|
+
if (child !== _this5.document.documentElement) {
|
|
18510
18614
|
child.ownerDocument = null;
|
|
18511
18615
|
}
|
|
18512
18616
|
|
|
@@ -18516,14 +18620,14 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18516
18620
|
};
|
|
18517
18621
|
|
|
18518
18622
|
_proto.mountChildren = function mountChildren(parent) {
|
|
18519
|
-
var
|
|
18623
|
+
var _this6 = this;
|
|
18520
18624
|
|
|
18521
18625
|
if (this.inited) {
|
|
18522
18626
|
parent.forEach(function (child) {
|
|
18523
18627
|
if (!child.isConnected) {
|
|
18524
|
-
child.ownerDocument =
|
|
18628
|
+
child.ownerDocument = _this6.document;
|
|
18525
18629
|
child.isConnected = true;
|
|
18526
|
-
child.dispatchEvent(
|
|
18630
|
+
child.dispatchEvent(mountEvent); // trigger after mounted
|
|
18527
18631
|
|
|
18528
18632
|
if (child instanceof CustomElement) {
|
|
18529
18633
|
if (child.connectedCallback) {
|
|
@@ -18580,12 +18684,12 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
18580
18684
|
_createClass(Canvas, [{
|
|
18581
18685
|
key: "ready",
|
|
18582
18686
|
get: function get() {
|
|
18583
|
-
var
|
|
18687
|
+
var _this7 = this;
|
|
18584
18688
|
|
|
18585
18689
|
if (!this.readyPromise) {
|
|
18586
18690
|
this.readyPromise = new Promise(function (resolve) {
|
|
18587
|
-
|
|
18588
|
-
resolve(
|
|
18691
|
+
_this7.resolveReadyPromise = function () {
|
|
18692
|
+
resolve(_this7);
|
|
18589
18693
|
};
|
|
18590
18694
|
});
|
|
18591
18695
|
|