@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.umd.js
CHANGED
|
@@ -5486,6 +5486,14 @@
|
|
|
5486
5486
|
};
|
|
5487
5487
|
|
|
5488
5488
|
function AABB(center, halfExtents) {
|
|
5489
|
+
if (center === void 0) {
|
|
5490
|
+
center = [0, 0, 0];
|
|
5491
|
+
}
|
|
5492
|
+
|
|
5493
|
+
if (halfExtents === void 0) {
|
|
5494
|
+
halfExtents = [0, 0, 0];
|
|
5495
|
+
}
|
|
5496
|
+
|
|
5489
5497
|
this.center = create$2();
|
|
5490
5498
|
this.halfExtents = create$2();
|
|
5491
5499
|
this.min = create$2();
|
|
@@ -5496,16 +5504,10 @@
|
|
|
5496
5504
|
var _proto = AABB.prototype;
|
|
5497
5505
|
|
|
5498
5506
|
_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);
|
|
5507
|
+
copy$1(this.center, center);
|
|
5508
|
+
copy$1(this.halfExtents, halfExtents);
|
|
5509
|
+
sub$1(this.min, this.center, this.halfExtents);
|
|
5510
|
+
add$1(this.max, this.center, this.halfExtents);
|
|
5509
5511
|
};
|
|
5510
5512
|
|
|
5511
5513
|
_proto.setMinMax = function setMinMax(min, max) {
|
|
@@ -14156,6 +14158,7 @@
|
|
|
14156
14158
|
// SyncWaterfallHook.prototype = null;
|
|
14157
14159
|
|
|
14158
14160
|
var genericFontFamilies = ['serif', 'sans-serif', 'monospace', 'cursive', 'fantasy', 'system-ui'];
|
|
14161
|
+
var stringRegExp = /([\"\'])[^\'\"]+\1/;
|
|
14159
14162
|
function toFontString(attributes) {
|
|
14160
14163
|
var fontSize = attributes.fontSize,
|
|
14161
14164
|
fontFamily = attributes.fontFamily,
|
|
@@ -14175,7 +14178,7 @@
|
|
|
14175
14178
|
var _fontFamily = fontFamilies[i].trim(); // Check if font already contains strings
|
|
14176
14179
|
|
|
14177
14180
|
|
|
14178
|
-
if (
|
|
14181
|
+
if (!stringRegExp.test(_fontFamily) && genericFontFamilies.indexOf(_fontFamily) < 0) {
|
|
14179
14182
|
_fontFamily = "\"" + _fontFamily + "\"";
|
|
14180
14183
|
}
|
|
14181
14184
|
|
|
@@ -14680,7 +14683,7 @@
|
|
|
14680
14683
|
d: '0'
|
|
14681
14684
|
}];
|
|
14682
14685
|
var propertyMetadataCache = {};
|
|
14683
|
-
var unresolvedProperties =
|
|
14686
|
+
var unresolvedProperties = new WeakMap();
|
|
14684
14687
|
var priorityMap = {};
|
|
14685
14688
|
var sortAttributeNames = memoize(function (attributeNames) {
|
|
14686
14689
|
return attributeNames.sort(function (a, b) {
|
|
@@ -14692,11 +14695,13 @@
|
|
|
14692
14695
|
var tmpVec3c = create$2();
|
|
14693
14696
|
|
|
14694
14697
|
var isPropertyResolved = function isPropertyResolved(object, name) {
|
|
14695
|
-
|
|
14698
|
+
var properties = unresolvedProperties.get(object);
|
|
14699
|
+
|
|
14700
|
+
if (!properties || properties.length === 0) {
|
|
14696
14701
|
return true;
|
|
14697
14702
|
}
|
|
14698
14703
|
|
|
14699
|
-
return
|
|
14704
|
+
return properties.includes(name);
|
|
14700
14705
|
};
|
|
14701
14706
|
|
|
14702
14707
|
var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
@@ -14942,12 +14947,15 @@
|
|
|
14942
14947
|
;
|
|
14943
14948
|
|
|
14944
14949
|
_proto.addUnresolveProperty = function addUnresolveProperty(object, name) {
|
|
14945
|
-
|
|
14946
|
-
|
|
14950
|
+
var properties = unresolvedProperties.get(object);
|
|
14951
|
+
|
|
14952
|
+
if (!properties) {
|
|
14953
|
+
unresolvedProperties.set(object, []);
|
|
14954
|
+
properties = unresolvedProperties.get(object);
|
|
14947
14955
|
}
|
|
14948
14956
|
|
|
14949
|
-
if (
|
|
14950
|
-
|
|
14957
|
+
if (properties.indexOf(name) === -1) {
|
|
14958
|
+
properties.push(name);
|
|
14951
14959
|
}
|
|
14952
14960
|
};
|
|
14953
14961
|
|
|
@@ -14983,7 +14991,7 @@
|
|
|
14983
14991
|
};
|
|
14984
14992
|
|
|
14985
14993
|
_proto.recalc = function recalc(object) {
|
|
14986
|
-
var properties = unresolvedProperties
|
|
14994
|
+
var properties = unresolvedProperties.get(object);
|
|
14987
14995
|
|
|
14988
14996
|
if (properties && properties.length) {
|
|
14989
14997
|
var attributes = {};
|
|
@@ -14991,7 +14999,7 @@
|
|
|
14991
14999
|
attributes[property] = object.attributes[property];
|
|
14992
15000
|
});
|
|
14993
15001
|
this.processProperties(object, attributes);
|
|
14994
|
-
delete
|
|
15002
|
+
unresolvedProperties.delete(object);
|
|
14995
15003
|
}
|
|
14996
15004
|
}
|
|
14997
15005
|
/**
|
|
@@ -16711,22 +16719,12 @@
|
|
|
16711
16719
|
*/
|
|
16712
16720
|
|
|
16713
16721
|
ElementEvent["INSERTED"] = "DOMNodeInserted";
|
|
16714
|
-
/**
|
|
16715
|
-
* it has had a child inserted
|
|
16716
|
-
*/
|
|
16717
|
-
|
|
16718
|
-
ElementEvent["CHILD_INSERTED"] = "child-inserted";
|
|
16719
16722
|
/**
|
|
16720
16723
|
* it is being removed
|
|
16721
16724
|
* @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeRemoved
|
|
16722
16725
|
*/
|
|
16723
16726
|
|
|
16724
16727
|
ElementEvent["REMOVED"] = "removed";
|
|
16725
|
-
/**
|
|
16726
|
-
* it has had a child removed
|
|
16727
|
-
*/
|
|
16728
|
-
|
|
16729
|
-
ElementEvent["CHILD_REMOVED"] = "child-removed";
|
|
16730
16728
|
/**
|
|
16731
16729
|
* @see https://www.w3.org/TR/DOM-Level-3-Events/#domnodeinsertedintodocument
|
|
16732
16730
|
*/
|
|
@@ -16781,17 +16779,10 @@
|
|
|
16781
16779
|
var entityCounter = 0;
|
|
16782
16780
|
function resetEntityCounter() {
|
|
16783
16781
|
entityCounter = 0;
|
|
16784
|
-
}
|
|
16785
|
-
|
|
16786
|
-
var childInsertedEvent = new CustomEvent(exports.ElementEvent.CHILD_INSERTED, {
|
|
16787
|
-
child: null
|
|
16788
|
-
});
|
|
16782
|
+
}
|
|
16789
16783
|
var insertedEvent = new MutationEvent(exports.ElementEvent.INSERTED, null, '', '', '', 0, '', '');
|
|
16790
16784
|
var removedEvent = new MutationEvent(exports.ElementEvent.REMOVED, null, '', '', '', 0, '', '');
|
|
16791
16785
|
var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
|
|
16792
|
-
var childRemovedEvent = new CustomEvent(exports.ElementEvent.CHILD_REMOVED, {
|
|
16793
|
-
child: null
|
|
16794
|
-
});
|
|
16795
16786
|
/**
|
|
16796
16787
|
* Has following capabilities:
|
|
16797
16788
|
* * Node insert/remove, eg. appendChild, removeChild, remove...
|
|
@@ -16929,19 +16920,13 @@
|
|
|
16929
16920
|
};
|
|
16930
16921
|
|
|
16931
16922
|
_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
|
-
// });
|
|
16923
|
+
var _this$ownerDocument;
|
|
16924
|
+
|
|
16925
|
+
runtime.sceneGraphService.attach(child, this, index);
|
|
16926
|
+
|
|
16927
|
+
if ((_this$ownerDocument = this.ownerDocument) === null || _this$ownerDocument === void 0 ? void 0 : _this$ownerDocument.defaultView) {
|
|
16928
|
+
this.ownerDocument.defaultView.mountChildren(child);
|
|
16929
|
+
}
|
|
16945
16930
|
|
|
16946
16931
|
insertedEvent.relatedNode = this;
|
|
16947
16932
|
child.dispatchEvent(insertedEvent);
|
|
@@ -16967,36 +16952,18 @@
|
|
|
16967
16952
|
};
|
|
16968
16953
|
|
|
16969
16954
|
_proto.removeChild = function removeChild(child) {
|
|
16955
|
+
var _child$ownerDocument;
|
|
16956
|
+
|
|
16970
16957
|
// should emit on itself before detach
|
|
16971
|
-
// child.emit(ElementEvent.REMOVED, {
|
|
16972
|
-
// parent: this,
|
|
16973
|
-
// });
|
|
16974
16958
|
removedEvent.relatedNode = this;
|
|
16975
|
-
child.dispatchEvent(removedEvent);
|
|
16976
|
-
|
|
16977
|
-
|
|
16978
|
-
|
|
16979
|
-
//
|
|
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
|
-
// }
|
|
16959
|
+
child.dispatchEvent(removedEvent);
|
|
16960
|
+
|
|
16961
|
+
if ((_child$ownerDocument = child.ownerDocument) === null || _child$ownerDocument === void 0 ? void 0 : _child$ownerDocument.defaultView) {
|
|
16962
|
+
child.ownerDocument.defaultView.unmountChildren(child);
|
|
16963
|
+
} // remove from scene graph
|
|
16999
16964
|
|
|
16965
|
+
|
|
16966
|
+
runtime.sceneGraphService.detach(child);
|
|
17000
16967
|
return child;
|
|
17001
16968
|
}
|
|
17002
16969
|
/**
|
|
@@ -17289,14 +17256,15 @@
|
|
|
17289
17256
|
var value = this.attributes[name];
|
|
17290
17257
|
|
|
17291
17258
|
if (value === undefined) {
|
|
17292
|
-
var _formatAttribute = formatAttribute(name
|
|
17259
|
+
var _formatAttribute = formatAttribute(name, ''),
|
|
17293
17260
|
attributeName = _formatAttribute[0];
|
|
17294
17261
|
|
|
17295
|
-
value = this.attributes[attributeName];
|
|
17296
|
-
} // if the given attribute does not exist, the value returned will either be null or ""
|
|
17297
|
-
|
|
17262
|
+
value = this.attributes[attributeName]; // if the given attribute does not exist, the value returned will either be null or ""
|
|
17298
17263
|
|
|
17299
|
-
|
|
17264
|
+
return isNil(value) ? null : value;
|
|
17265
|
+
} else {
|
|
17266
|
+
return value;
|
|
17267
|
+
}
|
|
17300
17268
|
}
|
|
17301
17269
|
/**
|
|
17302
17270
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
|
|
@@ -17739,6 +17707,11 @@
|
|
|
17739
17707
|
_this.config = void 0;
|
|
17740
17708
|
_this.isCustomElement = false;
|
|
17741
17709
|
_this.activeAnimations = [];
|
|
17710
|
+
|
|
17711
|
+
_this.getClip = function () {
|
|
17712
|
+
return this.style.clipPath || null;
|
|
17713
|
+
};
|
|
17714
|
+
|
|
17742
17715
|
_this.config = config; // compatible with G 3.0
|
|
17743
17716
|
|
|
17744
17717
|
_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
|
|
@@ -18111,10 +18084,7 @@
|
|
|
18111
18084
|
;
|
|
18112
18085
|
|
|
18113
18086
|
_proto.getEulerAngles = function getEulerAngles() {
|
|
18114
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18115
18087
|
var _getEuler = getEuler(create$2(), runtime.sceneGraphService.getWorldTransform(this)),
|
|
18116
|
-
ex = _getEuler[0],
|
|
18117
|
-
ey = _getEuler[1],
|
|
18118
18088
|
ez = _getEuler[2];
|
|
18119
18089
|
|
|
18120
18090
|
return rad2deg(ez);
|
|
@@ -18125,10 +18095,7 @@
|
|
|
18125
18095
|
;
|
|
18126
18096
|
|
|
18127
18097
|
_proto.getLocalEulerAngles = function getLocalEulerAngles() {
|
|
18128
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18129
18098
|
var _getEuler2 = getEuler(create$2(), runtime.sceneGraphService.getLocalRotation(this)),
|
|
18130
|
-
ex = _getEuler2[0],
|
|
18131
|
-
ey = _getEuler2[1],
|
|
18132
18099
|
ez = _getEuler2[2];
|
|
18133
18100
|
|
|
18134
18101
|
return rad2deg(ez);
|
|
@@ -18355,11 +18322,10 @@
|
|
|
18355
18322
|
sx = _mat4$getScaling[0],
|
|
18356
18323
|
sy = _mat4$getScaling[1];
|
|
18357
18324
|
|
|
18358
|
-
var rotation = getRotation(create$4(), transform);
|
|
18325
|
+
var rotation = getRotation(create$4(), transform);
|
|
18359
18326
|
|
|
18360
18327
|
var _getEuler3 = getEuler(create$2(), rotation),
|
|
18361
18328
|
eux = _getEuler3[0],
|
|
18362
|
-
euy = _getEuler3[1],
|
|
18363
18329
|
euz = _getEuler3[2]; // gimbal lock at 90 degrees
|
|
18364
18330
|
|
|
18365
18331
|
|
|
@@ -18423,6 +18389,145 @@
|
|
|
18423
18389
|
|
|
18424
18390
|
_proto.hide = function hide() {
|
|
18425
18391
|
this.style.visibility = 'hidden';
|
|
18392
|
+
}
|
|
18393
|
+
/**
|
|
18394
|
+
* Use `childElementCount` instead.
|
|
18395
|
+
* @deprecated
|
|
18396
|
+
*/
|
|
18397
|
+
;
|
|
18398
|
+
|
|
18399
|
+
_proto.getCount = function getCount() {
|
|
18400
|
+
return this.childElementCount;
|
|
18401
|
+
}
|
|
18402
|
+
/**
|
|
18403
|
+
* Use `parentElement` instead.
|
|
18404
|
+
* @deprecated
|
|
18405
|
+
*/
|
|
18406
|
+
;
|
|
18407
|
+
|
|
18408
|
+
_proto.getParent = function getParent() {
|
|
18409
|
+
return this.parentElement;
|
|
18410
|
+
}
|
|
18411
|
+
/**
|
|
18412
|
+
* Use `children` instead.
|
|
18413
|
+
* @deprecated
|
|
18414
|
+
*/
|
|
18415
|
+
;
|
|
18416
|
+
|
|
18417
|
+
_proto.getChildren = function getChildren() {
|
|
18418
|
+
return this.children;
|
|
18419
|
+
}
|
|
18420
|
+
/**
|
|
18421
|
+
* Use `firstElementChild` instead.
|
|
18422
|
+
* @deprecated
|
|
18423
|
+
*/
|
|
18424
|
+
;
|
|
18425
|
+
|
|
18426
|
+
_proto.getFirst = function getFirst() {
|
|
18427
|
+
return this.firstElementChild;
|
|
18428
|
+
}
|
|
18429
|
+
/**
|
|
18430
|
+
* Use `lastElementChild` instead.
|
|
18431
|
+
* @deprecated
|
|
18432
|
+
*/
|
|
18433
|
+
;
|
|
18434
|
+
|
|
18435
|
+
_proto.getLast = function getLast() {
|
|
18436
|
+
return this.lastElementChild;
|
|
18437
|
+
}
|
|
18438
|
+
/**
|
|
18439
|
+
* Use `this.children[index]` instead.
|
|
18440
|
+
* @deprecated
|
|
18441
|
+
*/
|
|
18442
|
+
;
|
|
18443
|
+
|
|
18444
|
+
_proto.getChildByIndex = function getChildByIndex(index) {
|
|
18445
|
+
return this.children[index] || null;
|
|
18446
|
+
}
|
|
18447
|
+
/**
|
|
18448
|
+
* Use `appendChild` instead.
|
|
18449
|
+
* @deprecated
|
|
18450
|
+
*/
|
|
18451
|
+
;
|
|
18452
|
+
|
|
18453
|
+
_proto.add = function add(child, index) {
|
|
18454
|
+
return this.appendChild(child, index);
|
|
18455
|
+
}
|
|
18456
|
+
/**
|
|
18457
|
+
* Use `this.style.clipPath` instead.
|
|
18458
|
+
* @deprecated
|
|
18459
|
+
*/
|
|
18460
|
+
;
|
|
18461
|
+
|
|
18462
|
+
_proto.setClip = function setClip(clipPath) {
|
|
18463
|
+
this.style.clipPath = clipPath;
|
|
18464
|
+
}
|
|
18465
|
+
/**
|
|
18466
|
+
* Use `this.style.clipPath` instead.
|
|
18467
|
+
* @deprecated
|
|
18468
|
+
*/
|
|
18469
|
+
;
|
|
18470
|
+
|
|
18471
|
+
/**
|
|
18472
|
+
* @deprecated
|
|
18473
|
+
*/
|
|
18474
|
+
_proto.set = function set(name, value) {
|
|
18475
|
+
// @ts-ignore
|
|
18476
|
+
this.config[name] = value;
|
|
18477
|
+
}
|
|
18478
|
+
/**
|
|
18479
|
+
* @deprecated
|
|
18480
|
+
*/
|
|
18481
|
+
;
|
|
18482
|
+
|
|
18483
|
+
_proto.get = function get(name) {
|
|
18484
|
+
return this.config[name];
|
|
18485
|
+
}
|
|
18486
|
+
/**
|
|
18487
|
+
* Use `setPosition` instead.
|
|
18488
|
+
* @deprecated
|
|
18489
|
+
*/
|
|
18490
|
+
;
|
|
18491
|
+
|
|
18492
|
+
_proto.moveTo = function moveTo(position, y, z) {
|
|
18493
|
+
if (y === void 0) {
|
|
18494
|
+
y = 0;
|
|
18495
|
+
}
|
|
18496
|
+
|
|
18497
|
+
if (z === void 0) {
|
|
18498
|
+
z = 0;
|
|
18499
|
+
}
|
|
18500
|
+
|
|
18501
|
+
this.setPosition(position, y, z);
|
|
18502
|
+
return this;
|
|
18503
|
+
}
|
|
18504
|
+
/**
|
|
18505
|
+
* Use `setPosition` instead.
|
|
18506
|
+
* @deprecated
|
|
18507
|
+
*/
|
|
18508
|
+
;
|
|
18509
|
+
|
|
18510
|
+
_proto.move = function move(position, y, z) {
|
|
18511
|
+
if (y === void 0) {
|
|
18512
|
+
y = 0;
|
|
18513
|
+
}
|
|
18514
|
+
|
|
18515
|
+
if (z === void 0) {
|
|
18516
|
+
z = 0;
|
|
18517
|
+
}
|
|
18518
|
+
|
|
18519
|
+
this.setPosition(position, y, z);
|
|
18520
|
+
return this;
|
|
18521
|
+
}
|
|
18522
|
+
/**
|
|
18523
|
+
* Use `this.style.zIndex` instead.
|
|
18524
|
+
* @deprecated
|
|
18525
|
+
*/
|
|
18526
|
+
;
|
|
18527
|
+
|
|
18528
|
+
_proto.setZIndex = function setZIndex(zIndex) {
|
|
18529
|
+
this.style.zIndex = zIndex;
|
|
18530
|
+
return this;
|
|
18426
18531
|
};
|
|
18427
18532
|
|
|
18428
18533
|
_createClass(DisplayObject, [{
|
|
@@ -19878,18 +19983,25 @@
|
|
|
19878
19983
|
ox = _this$canvas$viewport.x,
|
|
19879
19984
|
oy = _this$canvas$viewport.y;
|
|
19880
19985
|
|
|
19986
|
+
var roll = this.roll;
|
|
19987
|
+
this.rotate(0, 0, -roll);
|
|
19881
19988
|
this.setPosition(ox, oy);
|
|
19882
19989
|
this.setFocalPoint(ox, oy);
|
|
19883
19990
|
this.setZoom(zoom);
|
|
19991
|
+
this.rotate(0, 0, roll);
|
|
19884
19992
|
|
|
19885
19993
|
var _this$canvas$viewport2 = this.canvas.viewport2Canvas({
|
|
19886
19994
|
x: viewportPoint[0],
|
|
19887
19995
|
y: viewportPoint[1]
|
|
19888
19996
|
}),
|
|
19889
19997
|
cx = _this$canvas$viewport2.x,
|
|
19890
|
-
cy = _this$canvas$viewport2.y;
|
|
19998
|
+
cy = _this$canvas$viewport2.y; // project to rotated axis
|
|
19999
|
+
|
|
19891
20000
|
|
|
19892
|
-
|
|
20001
|
+
var dvec = fromValues$2(cx - ox, cy - oy, 0);
|
|
20002
|
+
var dx = dot(dvec, this.right) / length(this.right);
|
|
20003
|
+
var dy = dot(dvec, this.up) / length(this.up);
|
|
20004
|
+
this.pan(-dx, -dy);
|
|
19893
20005
|
return this;
|
|
19894
20006
|
};
|
|
19895
20007
|
|
|
@@ -24420,6 +24532,14 @@
|
|
|
24420
24532
|
var DEFAULT_CAMERA_Z = 500;
|
|
24421
24533
|
var DEFAULT_CAMERA_NEAR = 0.1;
|
|
24422
24534
|
var DEFAULT_CAMERA_FAR = 1000;
|
|
24535
|
+
/**
|
|
24536
|
+
* reuse custom event preventing from re-create them in every frame
|
|
24537
|
+
*/
|
|
24538
|
+
|
|
24539
|
+
var mountEvent = new CustomEvent(exports.ElementEvent.MOUNTED);
|
|
24540
|
+
var unmountEvent = new CustomEvent(exports.ElementEvent.UNMOUNTED);
|
|
24541
|
+
var beforeRenderEvent = new CustomEvent(exports.CanvasEvent.BEFORE_RENDER);
|
|
24542
|
+
var afterRenderEvent = new CustomEvent(exports.CanvasEvent.AFTER_RENDER);
|
|
24423
24543
|
/**
|
|
24424
24544
|
* can be treated like Window in DOM
|
|
24425
24545
|
* provide some extra methods like `window`, such as:
|
|
@@ -24477,10 +24597,6 @@
|
|
|
24477
24597
|
/**
|
|
24478
24598
|
* rAF in auto rendering
|
|
24479
24599
|
*/
|
|
24480
|
-
|
|
24481
|
-
/**
|
|
24482
|
-
* reuse custom event preventing from re-create them in every frame
|
|
24483
|
-
*/
|
|
24484
24600
|
function Canvas(config) {
|
|
24485
24601
|
var _this;
|
|
24486
24602
|
|
|
@@ -24500,10 +24616,6 @@
|
|
|
24500
24616
|
_this.inited = false;
|
|
24501
24617
|
_this.readyPromise = void 0;
|
|
24502
24618
|
_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
24619
|
_this.context = {};
|
|
24508
24620
|
_this.document = new Document();
|
|
24509
24621
|
_this.document.defaultView = _assertThisInitialized(_this); // create registry of custom elements
|
|
@@ -24608,8 +24720,6 @@
|
|
|
24608
24720
|
var _proto = Canvas.prototype;
|
|
24609
24721
|
|
|
24610
24722
|
_proto.initRenderingContext = function initRenderingContext(mergedConfig) {
|
|
24611
|
-
var _this2 = this;
|
|
24612
|
-
|
|
24613
24723
|
this.context.config = mergedConfig; // bind rendering context, shared by all renderers
|
|
24614
24724
|
|
|
24615
24725
|
this.context.renderingContext = {
|
|
@@ -24623,16 +24733,10 @@
|
|
|
24623
24733
|
force: false,
|
|
24624
24734
|
dirty: false
|
|
24625
24735
|
};
|
|
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
24736
|
};
|
|
24633
24737
|
|
|
24634
24738
|
_proto.initDefaultCamera = function initDefaultCamera(width, height) {
|
|
24635
|
-
var
|
|
24739
|
+
var _this2 = this;
|
|
24636
24740
|
|
|
24637
24741
|
// set a default ortho camera
|
|
24638
24742
|
var camera = new runtime.CameraContribution();
|
|
@@ -24641,7 +24745,7 @@
|
|
|
24641
24745
|
camera.canvas = this; // redraw when camera changed
|
|
24642
24746
|
|
|
24643
24747
|
camera.eventEmitter.on(CameraEvent.UPDATED, function () {
|
|
24644
|
-
|
|
24748
|
+
_this2.context.renderingContext.renderReasons.add(exports.RenderReason.CAMERA_CHANGED);
|
|
24645
24749
|
}); // bind camera
|
|
24646
24750
|
|
|
24647
24751
|
this.context.camera = camera;
|
|
@@ -24785,19 +24889,19 @@
|
|
|
24785
24889
|
};
|
|
24786
24890
|
|
|
24787
24891
|
_proto.render = function render() {
|
|
24788
|
-
this.dispatchEvent(
|
|
24892
|
+
this.dispatchEvent(beforeRenderEvent);
|
|
24789
24893
|
var renderingService = this.getRenderingService();
|
|
24790
24894
|
renderingService.render(this.getConfig());
|
|
24791
|
-
this.dispatchEvent(
|
|
24895
|
+
this.dispatchEvent(afterRenderEvent);
|
|
24792
24896
|
};
|
|
24793
24897
|
|
|
24794
24898
|
_proto.run = function run() {
|
|
24795
|
-
var
|
|
24899
|
+
var _this3 = this;
|
|
24796
24900
|
|
|
24797
24901
|
var tick = function tick() {
|
|
24798
|
-
|
|
24902
|
+
_this3.render();
|
|
24799
24903
|
|
|
24800
|
-
|
|
24904
|
+
_this3.frameId = requestAnimationFrame(tick);
|
|
24801
24905
|
};
|
|
24802
24906
|
|
|
24803
24907
|
tick();
|
|
@@ -24875,12 +24979,12 @@
|
|
|
24875
24979
|
}();
|
|
24876
24980
|
|
|
24877
24981
|
_proto.loadRendererContainerModule = function loadRendererContainerModule(renderer) {
|
|
24878
|
-
var
|
|
24982
|
+
var _this4 = this;
|
|
24879
24983
|
|
|
24880
24984
|
// load other container modules provided by g-canvas/g-svg/g-webgl
|
|
24881
24985
|
var plugins = renderer.getPlugins();
|
|
24882
24986
|
plugins.forEach(function (plugin) {
|
|
24883
|
-
plugin.context =
|
|
24987
|
+
plugin.context = _this4.context;
|
|
24884
24988
|
plugin.init();
|
|
24885
24989
|
});
|
|
24886
24990
|
};
|
|
@@ -24936,7 +25040,7 @@
|
|
|
24936
25040
|
};
|
|
24937
25041
|
|
|
24938
25042
|
_proto.unmountChildren = function unmountChildren(parent) {
|
|
24939
|
-
var
|
|
25043
|
+
var _this5 = this;
|
|
24940
25044
|
|
|
24941
25045
|
if (this.inited) {
|
|
24942
25046
|
var path = [];
|
|
@@ -24954,9 +25058,9 @@
|
|
|
24954
25058
|
}
|
|
24955
25059
|
}
|
|
24956
25060
|
|
|
24957
|
-
child.dispatchEvent(
|
|
25061
|
+
child.dispatchEvent(unmountEvent); // skip document.documentElement
|
|
24958
25062
|
|
|
24959
|
-
if (child !==
|
|
25063
|
+
if (child !== _this5.document.documentElement) {
|
|
24960
25064
|
child.ownerDocument = null;
|
|
24961
25065
|
}
|
|
24962
25066
|
|
|
@@ -24966,14 +25070,14 @@
|
|
|
24966
25070
|
};
|
|
24967
25071
|
|
|
24968
25072
|
_proto.mountChildren = function mountChildren(parent) {
|
|
24969
|
-
var
|
|
25073
|
+
var _this6 = this;
|
|
24970
25074
|
|
|
24971
25075
|
if (this.inited) {
|
|
24972
25076
|
parent.forEach(function (child) {
|
|
24973
25077
|
if (!child.isConnected) {
|
|
24974
|
-
child.ownerDocument =
|
|
25078
|
+
child.ownerDocument = _this6.document;
|
|
24975
25079
|
child.isConnected = true;
|
|
24976
|
-
child.dispatchEvent(
|
|
25080
|
+
child.dispatchEvent(mountEvent); // trigger after mounted
|
|
24977
25081
|
|
|
24978
25082
|
if (child instanceof CustomElement) {
|
|
24979
25083
|
if (child.connectedCallback) {
|
|
@@ -25030,12 +25134,12 @@
|
|
|
25030
25134
|
_createClass(Canvas, [{
|
|
25031
25135
|
key: "ready",
|
|
25032
25136
|
get: function get() {
|
|
25033
|
-
var
|
|
25137
|
+
var _this7 = this;
|
|
25034
25138
|
|
|
25035
25139
|
if (!this.readyPromise) {
|
|
25036
25140
|
this.readyPromise = new Promise(function (resolve) {
|
|
25037
|
-
|
|
25038
|
-
resolve(
|
|
25141
|
+
_this7.resolveReadyPromise = function () {
|
|
25142
|
+
resolve(_this7);
|
|
25039
25143
|
};
|
|
25040
25144
|
});
|
|
25041
25145
|
|