@antv/g 5.5.3 → 5.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AbstractRenderer.d.ts +9 -2
- package/dist/AbstractRenderer.d.ts.map +1 -1
- package/dist/Canvas.d.ts +2 -1
- package/dist/Canvas.d.ts.map +1 -1
- package/dist/css/StyleValueRegistry.d.ts.map +1 -1
- package/dist/css/interfaces.d.ts +1 -0
- package/dist/css/interfaces.d.ts.map +1 -1
- package/dist/css/parser/transform-origin.d.ts.map +1 -1
- package/dist/css/parser/transform.d.ts +1 -0
- package/dist/css/parser/transform.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyTransform.d.ts.map +1 -1
- package/dist/display-objects/DisplayObject.d.ts.map +1 -1
- package/dist/display-objects/Text.d.ts +4 -19
- package/dist/display-objects/Text.d.ts.map +1 -1
- package/dist/dom/Document.d.ts +3 -3
- package/dist/dom/Document.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +2003 -1950
- package/dist/index.js +2004 -1949
- package/dist/index.umd.js +3370 -2136
- package/dist/index.umd.min.js +2 -2
- package/dist/services/RenderingContext.d.ts +0 -1
- package/dist/services/RenderingContext.d.ts.map +1 -1
- package/dist/services/RenderingService.d.ts.map +1 -1
- package/dist/services/TextService.d.ts.map +1 -1
- package/dist/types.d.ts +9 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -8760,12 +8760,12 @@ function convertToMatrix(transformList) {
|
|
|
8760
8760
|
|
|
8761
8761
|
function makeMatrixDecomposition(transformList) {
|
|
8762
8762
|
var translate = [0, 0, 0];
|
|
8763
|
-
var scale = [
|
|
8763
|
+
var scale = [1, 1, 1];
|
|
8764
8764
|
var skew = [0, 0, 0];
|
|
8765
8765
|
var perspective = [0, 0, 0, 1];
|
|
8766
8766
|
var quaternion = [0, 0, 0, 1];
|
|
8767
8767
|
decomposeMatrix(convertToMatrix(transformList), translate, scale, skew, perspective, quaternion);
|
|
8768
|
-
return [translate, scale, skew, quaternion, perspective];
|
|
8768
|
+
return [[translate, scale, skew, quaternion, perspective]];
|
|
8769
8769
|
}
|
|
8770
8770
|
|
|
8771
8771
|
var composeMatrix = function () {
|
|
@@ -8860,14 +8860,16 @@ function mergeMatrices(left, right) {
|
|
|
8860
8860
|
|
|
8861
8861
|
if (left.decompositionPair !== right) {
|
|
8862
8862
|
// @ts-ignore
|
|
8863
|
-
left.decompositionPair = right;
|
|
8863
|
+
left.decompositionPair = right; // @ts-ignore
|
|
8864
|
+
|
|
8864
8865
|
leftArgs = makeMatrixDecomposition(left);
|
|
8865
8866
|
} // @ts-ignore
|
|
8866
8867
|
|
|
8867
8868
|
|
|
8868
8869
|
if (right.decompositionPair !== left) {
|
|
8869
8870
|
// @ts-ignore
|
|
8870
|
-
right.decompositionPair = left;
|
|
8871
|
+
right.decompositionPair = left; // @ts-ignore
|
|
8872
|
+
|
|
8871
8873
|
rightArgs = makeMatrixDecomposition(right);
|
|
8872
8874
|
}
|
|
8873
8875
|
|
|
@@ -9054,7 +9056,15 @@ function mergeTransforms(left, right, target) {
|
|
|
9054
9056
|
var stringifiedArgs = args.map(function (arg, j) {
|
|
9055
9057
|
return types[i][1][j](arg);
|
|
9056
9058
|
}).join(',');
|
|
9057
|
-
|
|
9059
|
+
|
|
9060
|
+
if (types[i][0] === 'matrix' && stringifiedArgs.split(',').length === 16) {
|
|
9061
|
+
types[i][0] = 'matrix3d';
|
|
9062
|
+
}
|
|
9063
|
+
|
|
9064
|
+
if (types[i][0] === 'matrix3d' && stringifiedArgs.split(',').length === 6) {
|
|
9065
|
+
types[i][0] = 'matrix';
|
|
9066
|
+
}
|
|
9067
|
+
|
|
9058
9068
|
return types[i][0] + '(' + stringifiedArgs + ')';
|
|
9059
9069
|
}).join(' ');
|
|
9060
9070
|
}];
|
|
@@ -9067,6 +9077,10 @@ function mergeTransforms(left, right, target) {
|
|
|
9067
9077
|
|
|
9068
9078
|
function parseTransformOrigin(value) {
|
|
9069
9079
|
if (isString(value)) {
|
|
9080
|
+
if (value === 'text-anchor') {
|
|
9081
|
+
return [new CSSUnitValue(0, 'px'), new CSSUnitValue(0, 'px')];
|
|
9082
|
+
}
|
|
9083
|
+
|
|
9070
9084
|
var values = value.split(' ');
|
|
9071
9085
|
|
|
9072
9086
|
if (values.length === 1) {
|
|
@@ -10559,2337 +10573,2320 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
10559
10573
|
return Element;
|
|
10560
10574
|
}(Node);
|
|
10561
10575
|
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10576
|
+
var DisplayObjectPool = /*#__PURE__*/function () {
|
|
10577
|
+
function DisplayObjectPool() {
|
|
10578
|
+
this.pool = {};
|
|
10579
|
+
this.htmlPool = [];
|
|
10580
|
+
}
|
|
10565
10581
|
|
|
10566
|
-
var
|
|
10567
|
-
_inheritsLoose(AnimationEvent, _FederatedEvent);
|
|
10582
|
+
var _proto = DisplayObjectPool.prototype;
|
|
10568
10583
|
|
|
10569
|
-
function
|
|
10570
|
-
|
|
10584
|
+
_proto.getByEntity = function getByEntity(entity) {
|
|
10585
|
+
return this.pool[entity];
|
|
10586
|
+
};
|
|
10571
10587
|
|
|
10572
|
-
|
|
10573
|
-
|
|
10574
|
-
_this.timelineTime = void 0;
|
|
10575
|
-
_this.currentTime = currentTime;
|
|
10576
|
-
_this.timelineTime = timelineTime; // @ts-ignore
|
|
10588
|
+
_proto.add = function add(entity, groupOrShape) {
|
|
10589
|
+
this.pool[entity] = groupOrShape;
|
|
10577
10590
|
|
|
10578
|
-
|
|
10579
|
-
|
|
10580
|
-
|
|
10591
|
+
if (groupOrShape.nodeName === Shape.HTML) {
|
|
10592
|
+
this.htmlPool.push(groupOrShape);
|
|
10593
|
+
}
|
|
10594
|
+
};
|
|
10581
10595
|
|
|
10582
|
-
|
|
10583
|
-
|
|
10584
|
-
|
|
10585
|
-
_this.timeStamp = Date.now();
|
|
10586
|
-
_this.currentTime = currentTime;
|
|
10587
|
-
_this.timelineTime = timelineTime;
|
|
10588
|
-
return _this;
|
|
10589
|
-
}
|
|
10596
|
+
_proto.remove = function remove(entity) {
|
|
10597
|
+
var existed = this.pool[entity];
|
|
10598
|
+
delete this.pool[entity];
|
|
10590
10599
|
|
|
10591
|
-
|
|
10592
|
-
|
|
10600
|
+
if (existed.nodeName === Shape.HTML) {
|
|
10601
|
+
var index = this.htmlPool.indexOf(existed);
|
|
10602
|
+
this.htmlPool.splice(index, 1);
|
|
10603
|
+
}
|
|
10604
|
+
};
|
|
10593
10605
|
|
|
10594
|
-
|
|
10606
|
+
_proto.getHTMLs = function getHTMLs() {
|
|
10607
|
+
return this.htmlPool;
|
|
10608
|
+
};
|
|
10609
|
+
|
|
10610
|
+
return DisplayObjectPool;
|
|
10611
|
+
}();
|
|
10612
|
+
|
|
10613
|
+
DisplayObjectPool = __decorate([singleton()], DisplayObjectPool);
|
|
10614
|
+
|
|
10615
|
+
var DEFAULT_STYLE_PROPS = {
|
|
10616
|
+
anchor: '',
|
|
10617
|
+
opacity: '',
|
|
10618
|
+
fillOpacity: '',
|
|
10619
|
+
strokeOpacity: '',
|
|
10620
|
+
fill: '',
|
|
10621
|
+
stroke: '',
|
|
10622
|
+
transform: '',
|
|
10623
|
+
transformOrigin: '',
|
|
10624
|
+
visibility: '',
|
|
10625
|
+
pointerEvents: '',
|
|
10626
|
+
lineWidth: '',
|
|
10627
|
+
lineCap: '',
|
|
10628
|
+
lineJoin: '',
|
|
10629
|
+
increasedLineWidthForHitTesting: '',
|
|
10630
|
+
fontSize: '',
|
|
10631
|
+
fontFamily: '',
|
|
10632
|
+
fontStyle: '',
|
|
10633
|
+
fontWeight: '',
|
|
10634
|
+
fontVariant: '',
|
|
10635
|
+
textAlign: '',
|
|
10636
|
+
textBaseline: '',
|
|
10637
|
+
textTransform: '',
|
|
10638
|
+
zIndex: '',
|
|
10639
|
+
filter: '',
|
|
10640
|
+
shadowType: ''
|
|
10641
|
+
};
|
|
10595
10642
|
/**
|
|
10596
|
-
*
|
|
10643
|
+
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
10644
|
+
*
|
|
10645
|
+
* mixins: Animatable, Transformable, Visible
|
|
10646
|
+
* @see https://github.com/tannerntannern/ts-mixer/blob/master/README.md#mixing-generic-classes
|
|
10647
|
+
*
|
|
10648
|
+
* Provide abilities in scene graph, such as:
|
|
10649
|
+
* * transform `translate/rotate/scale`
|
|
10650
|
+
* * add/remove child
|
|
10651
|
+
* * visibility and z-index
|
|
10652
|
+
*
|
|
10653
|
+
* Those abilities are implemented with those components: `Transform/Sortable/Visible`.
|
|
10654
|
+
*
|
|
10655
|
+
* Emit following events:
|
|
10656
|
+
* * init
|
|
10657
|
+
* * destroy
|
|
10658
|
+
* * attributeChanged
|
|
10597
10659
|
*/
|
|
10598
10660
|
|
|
10599
|
-
var
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
this.timeline = void 0;
|
|
10603
|
-
this.id = void 0;
|
|
10604
|
-
this.currentTimePending = false;
|
|
10605
|
-
this._idle = true;
|
|
10606
|
-
this._paused = false;
|
|
10607
|
-
this._finishedFlag = true;
|
|
10608
|
-
this.oldPlayState = void 0;
|
|
10609
|
-
this._holdTime = void 0;
|
|
10610
|
-
this.readyPromise = void 0;
|
|
10611
|
-
this.finishedPromise = void 0;
|
|
10612
|
-
this.resolveReadyPromise = void 0;
|
|
10613
|
-
this.rejectReadyPromise = void 0;
|
|
10614
|
-
this.resolveFinishedPromise = void 0;
|
|
10615
|
-
this.rejectFinishedPromise = void 0;
|
|
10616
|
-
this.onfinish = void 0;
|
|
10617
|
-
this.oncancel = void 0;
|
|
10618
|
-
this.onframe = void 0;
|
|
10619
|
-
this._currentTime = 0;
|
|
10620
|
-
this._startTime = void 0;
|
|
10621
|
-
this._playbackRate = 1;
|
|
10622
|
-
this._inEffect = void 0;
|
|
10623
|
-
this._inTimeline = true;
|
|
10624
|
-
this.onremove = void 0;
|
|
10625
|
-
this.effect = effect;
|
|
10626
|
-
effect.animation = this;
|
|
10627
|
-
this.timeline = timeline;
|
|
10628
|
-
this.id = "" + sequenceNumber++;
|
|
10629
|
-
this._inEffect = !!this.effect.update(0);
|
|
10630
|
-
this._holdTime = 0;
|
|
10631
|
-
this._paused = false;
|
|
10632
|
-
this.oldPlayState = 'idle';
|
|
10633
|
-
this.updatePromises();
|
|
10634
|
-
}
|
|
10661
|
+
var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
10662
|
+
_inheritsLoose(DisplayObject, _Element);
|
|
10663
|
+
|
|
10635
10664
|
/**
|
|
10636
|
-
*
|
|
10637
|
-
* resolve/reject ready/finished Promise according to current state
|
|
10665
|
+
* contains style props in constructor's params, eg. fill, stroke...
|
|
10638
10666
|
*/
|
|
10639
10667
|
|
|
10668
|
+
/**
|
|
10669
|
+
* push to active animations after calling `animate()`
|
|
10670
|
+
*/
|
|
10671
|
+
function DisplayObject(config) {
|
|
10672
|
+
var _this$config$capture;
|
|
10640
10673
|
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
_proto.updatePromises = function updatePromises() {
|
|
10644
|
-
var oldPlayState = this.oldPlayState;
|
|
10645
|
-
var newPlayState = this.pending ? 'pending' : this.playState;
|
|
10646
|
-
|
|
10647
|
-
if (this.readyPromise && newPlayState !== oldPlayState) {
|
|
10648
|
-
if (newPlayState === 'idle') {
|
|
10649
|
-
this.rejectReadyPromise();
|
|
10650
|
-
this.readyPromise = undefined;
|
|
10651
|
-
} else if (oldPlayState === 'pending') {
|
|
10652
|
-
this.resolveReadyPromise();
|
|
10653
|
-
} else if (newPlayState === 'pending') {
|
|
10654
|
-
this.readyPromise = undefined;
|
|
10655
|
-
}
|
|
10656
|
-
}
|
|
10657
|
-
|
|
10658
|
-
if (this.finishedPromise && newPlayState !== oldPlayState) {
|
|
10659
|
-
if (newPlayState === 'idle') {
|
|
10660
|
-
this.rejectFinishedPromise();
|
|
10661
|
-
this.finishedPromise = undefined;
|
|
10662
|
-
} else if (newPlayState === 'finished') {
|
|
10663
|
-
this.resolveFinishedPromise();
|
|
10664
|
-
} else if (oldPlayState === 'finished') {
|
|
10665
|
-
this.finishedPromise = undefined;
|
|
10666
|
-
}
|
|
10667
|
-
}
|
|
10674
|
+
var _this;
|
|
10668
10675
|
|
|
10669
|
-
|
|
10670
|
-
|
|
10671
|
-
};
|
|
10676
|
+
_this = _Element.call(this) || this; // assign name, id to config
|
|
10677
|
+
// eg. group.get('name')
|
|
10672
10678
|
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
|
|
10679
|
+
_this.config = void 0;
|
|
10680
|
+
_this.styleValueRegistry = GlobalContainer.get(StyleValueRegistry);
|
|
10681
|
+
_this.isCustomElement = false;
|
|
10682
|
+
_this.activeAnimations = [];
|
|
10683
|
+
_this.mutationEvent = new MutationEvent(ElementEvent.ATTR_MODIFIED, _assertThisInitialized(_this), null, null, null, MutationEvent.MODIFICATION, null, null);
|
|
10684
|
+
_this.config = config; // compatible with G 3.0
|
|
10676
10685
|
|
|
10677
|
-
|
|
10678
|
-
this.rewind();
|
|
10679
|
-
this._startTime = null;
|
|
10680
|
-
}
|
|
10686
|
+
_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
|
|
10681
10687
|
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
this.ensureAlive();
|
|
10685
|
-
this.timeline.applyDirtiedAnimation(this);
|
|
10688
|
+
_this.id = _this.config.id || '';
|
|
10689
|
+
_this.name = _this.config.name || '';
|
|
10686
10690
|
|
|
10687
|
-
if (
|
|
10688
|
-
|
|
10691
|
+
if (_this.config.className || _this.config.class) {
|
|
10692
|
+
_this.className = _this.config.className || _this.config.class;
|
|
10689
10693
|
}
|
|
10690
10694
|
|
|
10691
|
-
|
|
10692
|
-
};
|
|
10695
|
+
_this.nodeName = _this.config.type || Shape.GROUP; // compatible with G 3.0
|
|
10693
10696
|
|
|
10694
|
-
|
|
10695
|
-
this.updatePromises();
|
|
10697
|
+
_this.config.style = _extends({}, DEFAULT_STYLE_PROPS, _this.config.style, _this.config.attrs);
|
|
10696
10698
|
|
|
10697
|
-
if (
|
|
10698
|
-
|
|
10699
|
+
if (_this.config.visible != null) {
|
|
10700
|
+
_this.config.style.visibility = _this.config.visible === false ? 'hidden' : 'visible';
|
|
10699
10701
|
}
|
|
10700
10702
|
|
|
10701
|
-
if (
|
|
10702
|
-
|
|
10703
|
-
} else if (this._idle) {
|
|
10704
|
-
this.rewind();
|
|
10705
|
-
this._idle = false;
|
|
10703
|
+
if (_this.config.interactive != null) {
|
|
10704
|
+
_this.config.style.pointerEvents = _this.config.interactive === false ? 'none' : 'auto';
|
|
10706
10705
|
}
|
|
10707
10706
|
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10707
|
+
_this.style = new Proxy(_extends({}, _this.attributes, {
|
|
10708
|
+
setProperty: function setProperty(propertyName, value) {
|
|
10709
|
+
_this.setAttribute(propertyName, value);
|
|
10710
|
+
},
|
|
10711
|
+
getPropertyValue: function getPropertyValue(propertyName) {
|
|
10712
|
+
return _this.getAttribute(propertyName);
|
|
10713
|
+
},
|
|
10714
|
+
removeProperty: function removeProperty(propertyName) {
|
|
10715
|
+
_this.removeAttribute(propertyName);
|
|
10716
|
+
},
|
|
10717
|
+
item: function item() {
|
|
10718
|
+
return '';
|
|
10719
|
+
}
|
|
10720
|
+
}), {
|
|
10721
|
+
get: function get(target, name) {
|
|
10722
|
+
if (target[name] !== undefined) {
|
|
10723
|
+
// if (name in target) {
|
|
10724
|
+
return target[name];
|
|
10725
|
+
}
|
|
10712
10726
|
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
this._startTime = this.totalDuration - this.currentTime;
|
|
10718
|
-
this.currentTimePending = false;
|
|
10719
|
-
this.timeline.applyDirtiedAnimation(this);
|
|
10720
|
-
this.updatePromises();
|
|
10721
|
-
};
|
|
10722
|
-
|
|
10723
|
-
_proto.cancel = function cancel() {
|
|
10724
|
-
this.updatePromises();
|
|
10725
|
-
if (!this._inEffect) return;
|
|
10726
|
-
this._inEffect = false;
|
|
10727
|
-
this._idle = true;
|
|
10728
|
-
this._paused = false;
|
|
10729
|
-
this._finishedFlag = true;
|
|
10730
|
-
this._currentTime = 0;
|
|
10731
|
-
this._startTime = null;
|
|
10732
|
-
this.effect.update(null); // effects are invalid after cancellation as the animation state
|
|
10733
|
-
// needs to un-apply.
|
|
10727
|
+
return _this.getAttribute(name);
|
|
10728
|
+
},
|
|
10729
|
+
set: function set(_, prop, value) {
|
|
10730
|
+
_this.setAttribute(prop, value);
|
|
10734
10731
|
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10732
|
+
return true;
|
|
10733
|
+
}
|
|
10734
|
+
});
|
|
10738
10735
|
|
|
10739
|
-
|
|
10740
|
-
this.updatePromises();
|
|
10741
|
-
var oldCurrentTime = this.currentTime;
|
|
10742
|
-
this.playbackRate *= -1;
|
|
10743
|
-
this.play();
|
|
10736
|
+
_this.initAttributes(_this.config.style); // insert this group into pool
|
|
10744
10737
|
|
|
10745
|
-
if (oldCurrentTime !== null) {
|
|
10746
|
-
this.currentTime = oldCurrentTime;
|
|
10747
|
-
}
|
|
10748
10738
|
|
|
10749
|
-
|
|
10739
|
+
GlobalContainer.get(DisplayObjectPool).add(_this.entity, _assertThisInitialized(_this));
|
|
10740
|
+
return _this;
|
|
10750
10741
|
}
|
|
10751
|
-
/**
|
|
10752
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/updatePlaybackRate
|
|
10753
|
-
*/
|
|
10754
|
-
;
|
|
10755
10742
|
|
|
10756
|
-
_proto
|
|
10757
|
-
this.playbackRate = playbackRate;
|
|
10758
|
-
};
|
|
10743
|
+
var _proto = DisplayObject.prototype;
|
|
10759
10744
|
|
|
10760
|
-
_proto.
|
|
10761
|
-
|
|
10745
|
+
_proto.destroy = function destroy() {
|
|
10746
|
+
_Element.prototype.destroy.call(this); // remove from into pool
|
|
10762
10747
|
|
|
10763
|
-
var target = (_this$effect = this.effect) === null || _this$effect === void 0 ? void 0 : _this$effect.target;
|
|
10764
|
-
return target.getAnimations();
|
|
10765
|
-
};
|
|
10766
10748
|
|
|
10767
|
-
|
|
10768
|
-
var animations = this.targetAnimations();
|
|
10749
|
+
GlobalContainer.get(DisplayObjectPool).remove(this.entity); // stop all active animations
|
|
10769
10750
|
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
}
|
|
10751
|
+
this.getAnimations().forEach(function (animation) {
|
|
10752
|
+
animation.cancel();
|
|
10753
|
+
});
|
|
10773
10754
|
};
|
|
10774
10755
|
|
|
10775
|
-
_proto.
|
|
10776
|
-
var
|
|
10777
|
-
|
|
10756
|
+
_proto.cloneNode = function cloneNode(deep) {
|
|
10757
|
+
var cloned = new this.constructor({
|
|
10758
|
+
// copy id & name
|
|
10759
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode#notes
|
|
10760
|
+
id: this.id,
|
|
10761
|
+
name: this.name,
|
|
10762
|
+
className: this.name,
|
|
10763
|
+
interactive: this.interactive,
|
|
10764
|
+
style: _extends({}, this.attributes)
|
|
10765
|
+
}); // apply transform
|
|
10778
10766
|
|
|
10779
|
-
|
|
10780
|
-
animations.splice(index, 1);
|
|
10781
|
-
}
|
|
10782
|
-
};
|
|
10767
|
+
cloned.setLocalTransform(this.getLocalTransform());
|
|
10783
10768
|
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
}
|
|
10790
|
-
} else if (!this._isFinished) {
|
|
10791
|
-
this.tickCurrentTime((timelineTime - this._startTime) * this.playbackRate);
|
|
10792
|
-
}
|
|
10769
|
+
if (deep) {
|
|
10770
|
+
this.children.forEach(function (child) {
|
|
10771
|
+
var clonedChild = child.cloneNode(deep);
|
|
10772
|
+
cloned.appendChild(clonedChild);
|
|
10773
|
+
});
|
|
10793
10774
|
}
|
|
10794
10775
|
|
|
10795
|
-
|
|
10796
|
-
this.currentTimePending = false;
|
|
10797
|
-
this.fireEvents(timelineTime);
|
|
10798
|
-
}
|
|
10776
|
+
return cloned;
|
|
10799
10777
|
};
|
|
10800
10778
|
|
|
10801
|
-
_proto.
|
|
10802
|
-
if (
|
|
10803
|
-
|
|
10804
|
-
} else if (this.totalDuration < Infinity) {
|
|
10805
|
-
this.currentTime = this.totalDuration;
|
|
10806
|
-
} else {
|
|
10807
|
-
throw new Error('Unable to rewind negative playback rate animation with infinite duration');
|
|
10779
|
+
_proto.initAttributes = function initAttributes(attributes) {
|
|
10780
|
+
if (attributes === void 0) {
|
|
10781
|
+
attributes = {};
|
|
10808
10782
|
}
|
|
10809
|
-
};
|
|
10810
10783
|
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10814
|
-
;
|
|
10815
|
-
|
|
10816
|
-
_proto.addEventListener = function addEventListener(type, listener, options) {
|
|
10817
|
-
throw new Error('Method not implemented.');
|
|
10818
|
-
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10819
|
-
;
|
|
10820
|
-
|
|
10821
|
-
_proto.removeEventListener = function removeEventListener(type, listener, options) {
|
|
10822
|
-
throw new Error('Method not implemented.');
|
|
10823
|
-
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10824
|
-
;
|
|
10784
|
+
var renderable = this.renderable;
|
|
10785
|
+
this.styleValueRegistry.processProperties(this, attributes); // redraw at next frame
|
|
10825
10786
|
|
|
10826
|
-
|
|
10827
|
-
throw new Error('Method not implemented.');
|
|
10787
|
+
renderable.dirty = true;
|
|
10828
10788
|
};
|
|
10829
10789
|
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10790
|
+
_proto.setAttribute = function setAttribute(name, value, force) {
|
|
10791
|
+
if (force === void 0) {
|
|
10792
|
+
force = false;
|
|
10793
|
+
}
|
|
10834
10794
|
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
// active interval (currentTime === 0).
|
|
10839
|
-
if (this.playbackRate < 0 && this.currentTime === 0) {
|
|
10840
|
-
var _this$effect2;
|
|
10795
|
+
var _formatAttribute = formatAttribute(name, value),
|
|
10796
|
+
attributeName = _formatAttribute[0],
|
|
10797
|
+
attributeValue = _formatAttribute[1]; // ignore undefined value
|
|
10841
10798
|
|
|
10842
|
-
this._inEffect = !!((_this$effect2 = this.effect) === null || _this$effect2 === void 0 ? void 0 : _this$effect2.update(-1));
|
|
10843
|
-
} else {
|
|
10844
|
-
var _this$effect3;
|
|
10845
10799
|
|
|
10846
|
-
|
|
10800
|
+
if (isUndefined(value)) {
|
|
10801
|
+
return;
|
|
10847
10802
|
}
|
|
10848
10803
|
|
|
10849
|
-
if (
|
|
10850
|
-
this.
|
|
10851
|
-
this.timeline.animations.push(this);
|
|
10852
|
-
}
|
|
10853
|
-
};
|
|
10804
|
+
if (force || attributeValue !== this.attributes[attributeName]) {
|
|
10805
|
+
this.internalSetAttribute(attributeName, attributeValue);
|
|
10854
10806
|
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
10807
|
+
_Element.prototype.setAttribute.call(this, attributeName, attributeValue);
|
|
10808
|
+
}
|
|
10809
|
+
}
|
|
10810
|
+
/**
|
|
10811
|
+
* called when attributes get changed or initialized
|
|
10812
|
+
*/
|
|
10813
|
+
;
|
|
10858
10814
|
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10815
|
+
_proto.internalSetAttribute = function internalSetAttribute(name, value, parseOptions) {
|
|
10816
|
+
var _this$styleValueRegis,
|
|
10817
|
+
_this2 = this;
|
|
10862
10818
|
|
|
10863
|
-
|
|
10819
|
+
if (parseOptions === void 0) {
|
|
10820
|
+
parseOptions = {};
|
|
10864
10821
|
}
|
|
10865
|
-
};
|
|
10866
10822
|
|
|
10867
|
-
|
|
10868
|
-
var
|
|
10823
|
+
var renderable = this.renderable;
|
|
10824
|
+
var oldValue = this.attributes[name];
|
|
10825
|
+
var oldParsedValue = this.parsedStyle[name];
|
|
10826
|
+
this.styleValueRegistry.processProperties(this, (_this$styleValueRegis = {}, _this$styleValueRegis[name] = value, _this$styleValueRegis), parseOptions); // inform clip path targets
|
|
10869
10827
|
|
|
10870
|
-
if (this.
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10828
|
+
if (this.parsedStyle.clipPathTargets && this.parsedStyle.clipPathTargets.length) {
|
|
10829
|
+
this.parsedStyle.clipPathTargets.forEach(function (target) {
|
|
10830
|
+
_this2.sceneGraphService.dirtifyToRoot(target);
|
|
10831
|
+
|
|
10832
|
+
target.dispatchEvent(new MutationEvent(ElementEvent.ATTR_MODIFIED, target, _this2, _this2, 'clipPath', MutationEvent.MODIFICATION, _this2, _this2));
|
|
10833
|
+
|
|
10834
|
+
if (target.isCustomElement && target.isConnected) {
|
|
10835
|
+
if (target.attributeChangedCallback) {
|
|
10836
|
+
target.attributeChangedCallback('clipPath', _this2, _this2);
|
|
10837
|
+
}
|
|
10879
10838
|
}
|
|
10839
|
+
});
|
|
10840
|
+
} // redraw at next frame
|
|
10880
10841
|
|
|
10881
|
-
this._finishedFlag = true;
|
|
10882
|
-
}
|
|
10883
|
-
} else {
|
|
10884
|
-
if (this.onframe && this.playState === 'running') {
|
|
10885
|
-
var _event = new AnimationEvent(null, this, this.currentTime, baseTime);
|
|
10886
10842
|
|
|
10887
|
-
|
|
10888
|
-
|
|
10843
|
+
renderable.dirty = true; // trigger later
|
|
10844
|
+
// this.sceneGraphService.pendingEvents.push([ElementEvent.ATTR_MODIFIED, { affectChildren }]);
|
|
10889
10845
|
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10846
|
+
this.mutationEvent.prevValue = oldValue;
|
|
10847
|
+
this.mutationEvent.newValue = value;
|
|
10848
|
+
this.mutationEvent.attrName = name;
|
|
10849
|
+
this.mutationEvent.prevParsedValue = oldParsedValue;
|
|
10850
|
+
this.mutationEvent.newParsedValue = this.parsedStyle[name];
|
|
10851
|
+
this.dispatchEvent(this.mutationEvent);
|
|
10893
10852
|
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10853
|
+
if (this.isCustomElement && this.isConnected) {
|
|
10854
|
+
if (this.attributeChangedCallback) {
|
|
10855
|
+
this.attributeChangedCallback(name, oldValue, value);
|
|
10856
|
+
}
|
|
10857
|
+
}
|
|
10858
|
+
} // #region transformable
|
|
10900
10859
|
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10860
|
+
/**
|
|
10861
|
+
* returns different values than getBoundingClientRect(), as the latter returns value relative to the viewport
|
|
10862
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox
|
|
10863
|
+
*
|
|
10864
|
+
* FIXME: It is worth noting that getBBox responds to original untransformed values of a drawn object.
|
|
10865
|
+
* @see https://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html#getBBox
|
|
10866
|
+
*/
|
|
10867
|
+
;
|
|
10904
10868
|
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
*/
|
|
10908
|
-
// animation: InternalAnimation | null;
|
|
10869
|
+
_proto.getBBox = function getBBox() {
|
|
10870
|
+
var aabb = this.getBounds();
|
|
10909
10871
|
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
function get() {
|
|
10914
|
-
return this._startTime === null && !this._paused && this.playbackRate !== 0 || this.currentTimePending;
|
|
10915
|
-
}
|
|
10916
|
-
}, {
|
|
10917
|
-
key: "playState",
|
|
10918
|
-
get: function get() {
|
|
10919
|
-
if (this._idle) return 'idle';
|
|
10920
|
-
if (this._isFinished) return 'finished';
|
|
10921
|
-
if (this._paused) return 'paused';
|
|
10922
|
-
return 'running';
|
|
10923
|
-
}
|
|
10924
|
-
/**
|
|
10925
|
-
* record previos state
|
|
10926
|
-
*/
|
|
10927
|
-
|
|
10928
|
-
}, {
|
|
10929
|
-
key: "ready",
|
|
10930
|
-
get:
|
|
10931
|
-
/**
|
|
10932
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/ready
|
|
10933
|
-
* @example
|
|
10934
|
-
animation.pause();
|
|
10935
|
-
animation.ready.then(function() {
|
|
10936
|
-
// Displays 'running'
|
|
10937
|
-
alert(animation.playState);
|
|
10938
|
-
});
|
|
10939
|
-
animation.play();
|
|
10940
|
-
*/
|
|
10941
|
-
function get() {
|
|
10942
|
-
var _this2 = this;
|
|
10943
|
-
|
|
10944
|
-
if (!this.readyPromise) {
|
|
10945
|
-
if (this.timeline.animationsWithPromises.indexOf(this) === -1) {
|
|
10946
|
-
this.timeline.animationsWithPromises.push(this);
|
|
10947
|
-
}
|
|
10948
|
-
|
|
10949
|
-
this.readyPromise = new Promise(function (resolve, reject) {
|
|
10950
|
-
_this2.resolveReadyPromise = function () {
|
|
10951
|
-
resolve(_this2);
|
|
10952
|
-
};
|
|
10872
|
+
var _aabb$getMin = aabb.getMin(),
|
|
10873
|
+
left = _aabb$getMin[0],
|
|
10874
|
+
top = _aabb$getMin[1];
|
|
10953
10875
|
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
});
|
|
10876
|
+
var _aabb$getMax = aabb.getMax(),
|
|
10877
|
+
right = _aabb$getMax[0],
|
|
10878
|
+
bottom = _aabb$getMax[1];
|
|
10958
10879
|
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
}
|
|
10962
|
-
}
|
|
10880
|
+
return new Rectangle(left, top, right - left, bottom - top);
|
|
10881
|
+
};
|
|
10963
10882
|
|
|
10964
|
-
|
|
10883
|
+
_proto.setOrigin = function setOrigin(position, y, z) {
|
|
10884
|
+
if (y === void 0) {
|
|
10885
|
+
y = 0;
|
|
10965
10886
|
}
|
|
10966
|
-
/**
|
|
10967
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/finished
|
|
10968
|
-
* @example
|
|
10969
|
-
Promise.all(
|
|
10970
|
-
elem.getAnimations().map(
|
|
10971
|
-
function(animation) {
|
|
10972
|
-
return animation.finished
|
|
10973
|
-
}
|
|
10974
|
-
)
|
|
10975
|
-
).then(
|
|
10976
|
-
function() {
|
|
10977
|
-
return elem.remove();
|
|
10978
|
-
}
|
|
10979
|
-
);
|
|
10980
|
-
*/
|
|
10981
|
-
|
|
10982
|
-
}, {
|
|
10983
|
-
key: "finished",
|
|
10984
|
-
get: function get() {
|
|
10985
|
-
var _this3 = this;
|
|
10986
|
-
|
|
10987
|
-
if (!this.finishedPromise) {
|
|
10988
|
-
if (this.timeline.animationsWithPromises.indexOf(this) === -1) {
|
|
10989
|
-
this.timeline.animationsWithPromises.push(this);
|
|
10990
|
-
}
|
|
10991
|
-
|
|
10992
|
-
this.finishedPromise = new Promise(function (resolve, reject) {
|
|
10993
|
-
_this3.resolveFinishedPromise = function () {
|
|
10994
|
-
resolve(_this3);
|
|
10995
|
-
};
|
|
10996
10887
|
|
|
10997
|
-
|
|
10998
|
-
|
|
10999
|
-
};
|
|
11000
|
-
});
|
|
11001
|
-
|
|
11002
|
-
if (this.playState === 'finished') {
|
|
11003
|
-
this.resolveFinishedPromise();
|
|
11004
|
-
}
|
|
11005
|
-
}
|
|
11006
|
-
|
|
11007
|
-
return this.finishedPromise;
|
|
10888
|
+
if (z === void 0) {
|
|
10889
|
+
z = 0;
|
|
11008
10890
|
}
|
|
11009
|
-
/**
|
|
11010
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/onfinish
|
|
11011
|
-
*/
|
|
11012
|
-
|
|
11013
|
-
}, {
|
|
11014
|
-
key: "currentTime",
|
|
11015
|
-
get:
|
|
11016
|
-
/**
|
|
11017
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/currentTime
|
|
11018
|
-
*/
|
|
11019
|
-
function get() {
|
|
11020
|
-
this.updatePromises();
|
|
11021
|
-
return this._idle || this.currentTimePending ? null : this._currentTime;
|
|
11022
|
-
},
|
|
11023
|
-
set: function set(newTime) {
|
|
11024
|
-
newTime = Number(newTime);
|
|
11025
|
-
if (isNaN(newTime)) return;
|
|
11026
|
-
this.timeline.restart();
|
|
11027
10891
|
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
this._startTime = Number((_this$timeline = this.timeline) === null || _this$timeline === void 0 ? void 0 : _this$timeline.currentTime) - newTime / this.playbackRate;
|
|
11032
|
-
}
|
|
11033
|
-
|
|
11034
|
-
this.currentTimePending = false;
|
|
11035
|
-
|
|
11036
|
-
if (this._currentTime === newTime) {
|
|
11037
|
-
return;
|
|
11038
|
-
}
|
|
10892
|
+
this.sceneGraphService.setOrigin(this, createVec3(position, y, z));
|
|
10893
|
+
return this;
|
|
10894
|
+
};
|
|
11039
10895
|
|
|
11040
|
-
|
|
11041
|
-
|
|
11042
|
-
|
|
11043
|
-
|
|
10896
|
+
_proto.getOrigin = function getOrigin() {
|
|
10897
|
+
return this.sceneGraphService.getOrigin(this);
|
|
10898
|
+
}
|
|
10899
|
+
/**
|
|
10900
|
+
* set position in world space
|
|
10901
|
+
*/
|
|
10902
|
+
;
|
|
11044
10903
|
|
|
11045
|
-
|
|
11046
|
-
|
|
10904
|
+
_proto.setPosition = function setPosition(position, y, z) {
|
|
10905
|
+
if (y === void 0) {
|
|
10906
|
+
y = 0;
|
|
11047
10907
|
}
|
|
11048
|
-
/**
|
|
11049
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/startTime
|
|
11050
|
-
*/
|
|
11051
10908
|
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
get: function get() {
|
|
11055
|
-
return this._startTime;
|
|
11056
|
-
},
|
|
11057
|
-
set: function set(newTime) {
|
|
11058
|
-
if (newTime !== null) {
|
|
11059
|
-
this.updatePromises();
|
|
11060
|
-
newTime = Number(newTime);
|
|
11061
|
-
if (isNaN(newTime)) return;
|
|
11062
|
-
if (this._paused || this._idle) return;
|
|
11063
|
-
this._startTime = newTime;
|
|
11064
|
-
this.tickCurrentTime((Number(this.timeline.currentTime) - this._startTime) * this.playbackRate);
|
|
11065
|
-
this.timeline.applyDirtiedAnimation(this);
|
|
11066
|
-
this.updatePromises();
|
|
11067
|
-
}
|
|
10909
|
+
if (z === void 0) {
|
|
10910
|
+
z = 0;
|
|
11068
10911
|
}
|
|
11069
|
-
}, {
|
|
11070
|
-
key: "playbackRate",
|
|
11071
|
-
get: function get() {
|
|
11072
|
-
return this._playbackRate;
|
|
11073
|
-
},
|
|
11074
|
-
set: function set(value) {
|
|
11075
|
-
if (value === this._playbackRate) {
|
|
11076
|
-
return;
|
|
11077
|
-
}
|
|
11078
|
-
|
|
11079
|
-
this.updatePromises();
|
|
11080
|
-
var oldCurrentTime = this.currentTime;
|
|
11081
|
-
this._playbackRate = value;
|
|
11082
|
-
this.startTime = null;
|
|
11083
|
-
|
|
11084
|
-
if (this.playState !== 'paused' && this.playState !== 'idle') {
|
|
11085
|
-
this._finishedFlag = false;
|
|
11086
|
-
this._idle = false;
|
|
11087
|
-
this.ensureAlive();
|
|
11088
|
-
this.timeline.applyDirtiedAnimation(this);
|
|
11089
|
-
}
|
|
11090
10912
|
|
|
11091
|
-
|
|
11092
|
-
|
|
11093
|
-
|
|
10913
|
+
this.sceneGraphService.setPosition(this, createVec3(position, y, z));
|
|
10914
|
+
return this;
|
|
10915
|
+
}
|
|
10916
|
+
/**
|
|
10917
|
+
* set position in local space
|
|
10918
|
+
*/
|
|
10919
|
+
;
|
|
11094
10920
|
|
|
11095
|
-
|
|
11096
|
-
|
|
11097
|
-
|
|
11098
|
-
key: "_isFinished",
|
|
11099
|
-
get: function get() {
|
|
11100
|
-
return !this._idle && (this._playbackRate > 0 && Number(this._currentTime) >= this.totalDuration || this._playbackRate < 0 && Number(this._currentTime) <= 0);
|
|
10921
|
+
_proto.setLocalPosition = function setLocalPosition(position, y, z) {
|
|
10922
|
+
if (y === void 0) {
|
|
10923
|
+
y = 0;
|
|
11101
10924
|
}
|
|
11102
|
-
}, {
|
|
11103
|
-
key: "totalDuration",
|
|
11104
|
-
get: function get() {
|
|
11105
|
-
var _this$effect4;
|
|
11106
10925
|
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
}, {
|
|
11110
|
-
key: "_needsTick",
|
|
11111
|
-
get: function get() {
|
|
11112
|
-
return this.pending || this.playState === 'running' || !this._finishedFlag;
|
|
10926
|
+
if (z === void 0) {
|
|
10927
|
+
z = 0;
|
|
11113
10928
|
}
|
|
11114
|
-
}]);
|
|
11115
|
-
|
|
11116
|
-
return Animation;
|
|
11117
|
-
}();
|
|
11118
|
-
|
|
11119
|
-
function compareAnimations(leftAnimation, rightAnimation) {
|
|
11120
|
-
return Number(leftAnimation.id) - Number(rightAnimation.id);
|
|
11121
|
-
}
|
|
11122
|
-
/**
|
|
11123
|
-
* @see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/web-animations-js/index.d.ts
|
|
11124
|
-
*/
|
|
11125
10929
|
|
|
11126
|
-
|
|
10930
|
+
this.sceneGraphService.setLocalPosition(this, createVec3(position, y, z));
|
|
10931
|
+
return this;
|
|
10932
|
+
}
|
|
11127
10933
|
/**
|
|
11128
|
-
*
|
|
10934
|
+
* translate in world space
|
|
11129
10935
|
*/
|
|
11130
|
-
|
|
11131
|
-
var _this = this;
|
|
11132
|
-
|
|
11133
|
-
this.document = void 0;
|
|
11134
|
-
this.animations = [];
|
|
11135
|
-
this.ticking = false;
|
|
11136
|
-
this.timelineTicking = false;
|
|
11137
|
-
this.hasRestartedThisFrame = false;
|
|
11138
|
-
this.animationsWithPromises = [];
|
|
11139
|
-
this.inTick = false;
|
|
11140
|
-
this.pendingEffects = [];
|
|
11141
|
-
this.currentTime = null;
|
|
11142
|
-
this.rafId = 0;
|
|
11143
|
-
this.rafCallbacks = [];
|
|
11144
|
-
this.frameId = void 0;
|
|
11145
|
-
|
|
11146
|
-
this.webAnimationsNextTick = function (t) {
|
|
11147
|
-
_this.currentTime = t;
|
|
11148
|
-
|
|
11149
|
-
_this.discardAnimations();
|
|
11150
|
-
|
|
11151
|
-
if (_this.animations.length === 0) {
|
|
11152
|
-
_this.timelineTicking = false;
|
|
11153
|
-
} else {
|
|
11154
|
-
_this.requestAnimationFrame(_this.webAnimationsNextTick);
|
|
11155
|
-
}
|
|
11156
|
-
};
|
|
11157
|
-
|
|
11158
|
-
this.processRafCallbacks = function (t) {
|
|
11159
|
-
var processing = _this.rafCallbacks;
|
|
11160
|
-
_this.rafCallbacks = [];
|
|
11161
|
-
if (t < Number(_this.currentTime)) t = Number(_this.currentTime);
|
|
11162
|
-
|
|
11163
|
-
_this.animations.sort(compareAnimations);
|
|
10936
|
+
;
|
|
11164
10937
|
|
|
11165
|
-
|
|
11166
|
-
|
|
11167
|
-
|
|
11168
|
-
|
|
10938
|
+
_proto.translate = function translate(position, y, z) {
|
|
10939
|
+
if (y === void 0) {
|
|
10940
|
+
y = 0;
|
|
10941
|
+
}
|
|
11169
10942
|
|
|
11170
|
-
|
|
11171
|
-
|
|
10943
|
+
if (z === void 0) {
|
|
10944
|
+
z = 0;
|
|
10945
|
+
}
|
|
11172
10946
|
|
|
11173
|
-
this.
|
|
10947
|
+
this.sceneGraphService.translate(this, createVec3(position, y, z));
|
|
10948
|
+
return this;
|
|
11174
10949
|
}
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
_proto.getAnimations = function getAnimations() {
|
|
11179
|
-
this.discardAnimations();
|
|
11180
|
-
return this.animations.slice();
|
|
11181
|
-
};
|
|
11182
|
-
|
|
11183
|
-
_proto.isTicking = function isTicking() {
|
|
11184
|
-
return this.inTick;
|
|
11185
|
-
};
|
|
11186
|
-
|
|
11187
|
-
_proto.play = function play(effect) {
|
|
11188
|
-
var animation = new Animation(effect, this);
|
|
11189
|
-
this.animations.push(animation);
|
|
11190
|
-
this.restartWebAnimationsNextTick();
|
|
11191
|
-
animation.updatePromises();
|
|
11192
|
-
animation.play();
|
|
11193
|
-
animation.updatePromises();
|
|
11194
|
-
return animation;
|
|
11195
|
-
} // RAF is supposed to be the last script to occur before frame rendering but not
|
|
11196
|
-
// all browsers behave like this. This function is for synchonously updating an
|
|
11197
|
-
// animation's effects whenever its state is mutated by script to work around
|
|
11198
|
-
// incorrect script execution ordering by the browser.
|
|
10950
|
+
/**
|
|
10951
|
+
* translate in local space
|
|
10952
|
+
*/
|
|
11199
10953
|
;
|
|
11200
10954
|
|
|
11201
|
-
_proto.
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
if (this.inTick) {
|
|
11205
|
-
return;
|
|
11206
|
-
} // update active animations in displayobject
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
animation.markTarget();
|
|
11210
|
-
var animations = animation.targetAnimations();
|
|
11211
|
-
animations.sort(compareAnimations); // clear inactive animations
|
|
11212
|
-
|
|
11213
|
-
var inactiveAnimations = this.tick(Number(this.currentTime), false, animations.slice())[1];
|
|
11214
|
-
inactiveAnimations.forEach(function (animation) {
|
|
11215
|
-
var index = _this2.animations.indexOf(animation);
|
|
11216
|
-
|
|
11217
|
-
if (index !== -1) {
|
|
11218
|
-
_this2.animations.splice(index, 1);
|
|
11219
|
-
}
|
|
11220
|
-
});
|
|
11221
|
-
this.applyPendingEffects();
|
|
11222
|
-
};
|
|
11223
|
-
|
|
11224
|
-
_proto.restart = function restart() {
|
|
11225
|
-
if (!this.ticking) {
|
|
11226
|
-
this.ticking = true;
|
|
11227
|
-
this.requestAnimationFrame(function () {});
|
|
11228
|
-
this.hasRestartedThisFrame = true;
|
|
10955
|
+
_proto.translateLocal = function translateLocal(position, y, z) {
|
|
10956
|
+
if (y === void 0) {
|
|
10957
|
+
y = 0;
|
|
11229
10958
|
}
|
|
11230
10959
|
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
_proto.destroy = function destroy() {
|
|
11235
|
-
this.document.defaultView.cancelAnimationFrame(this.frameId);
|
|
11236
|
-
};
|
|
10960
|
+
if (z === void 0) {
|
|
10961
|
+
z = 0;
|
|
10962
|
+
}
|
|
11237
10963
|
|
|
11238
|
-
|
|
11239
|
-
this
|
|
11240
|
-
effect === null || effect === void 0 ? void 0 : effect.applyInterpolations();
|
|
11241
|
-
});
|
|
11242
|
-
this.pendingEffects = [];
|
|
10964
|
+
this.sceneGraphService.translateLocal(this, createVec3(position, y, z));
|
|
10965
|
+
return this;
|
|
11243
10966
|
};
|
|
11244
10967
|
|
|
11245
|
-
_proto.
|
|
11246
|
-
|
|
11247
|
-
return animation.updatePromises();
|
|
11248
|
-
});
|
|
10968
|
+
_proto.getPosition = function getPosition() {
|
|
10969
|
+
return this.sceneGraphService.getPosition(this);
|
|
11249
10970
|
};
|
|
11250
10971
|
|
|
11251
|
-
_proto.
|
|
11252
|
-
this.
|
|
11253
|
-
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
|
|
10972
|
+
_proto.getLocalPosition = function getLocalPosition() {
|
|
10973
|
+
return this.sceneGraphService.getLocalPosition(this);
|
|
10974
|
+
}
|
|
10975
|
+
/**
|
|
10976
|
+
* compatible with G 3.0
|
|
10977
|
+
*
|
|
10978
|
+
* scaling in local space
|
|
10979
|
+
* scale(10) = scale(10, 10, 10)
|
|
10980
|
+
*
|
|
10981
|
+
* we can't set scale in world space
|
|
10982
|
+
*/
|
|
10983
|
+
;
|
|
11257
10984
|
|
|
11258
|
-
_proto.
|
|
11259
|
-
|
|
11260
|
-
this.timelineTicking = true;
|
|
11261
|
-
this.requestAnimationFrame(this.webAnimationsNextTick);
|
|
11262
|
-
}
|
|
10985
|
+
_proto.scale = function scale(scaling, y, z) {
|
|
10986
|
+
return this.scaleLocal(scaling, y, z);
|
|
11263
10987
|
};
|
|
11264
10988
|
|
|
11265
|
-
_proto.
|
|
11266
|
-
|
|
11267
|
-
|
|
11268
|
-
|
|
11269
|
-
|
|
10989
|
+
_proto.scaleLocal = function scaleLocal(scaling, y, z) {
|
|
10990
|
+
if (typeof scaling === 'number') {
|
|
10991
|
+
y = y || scaling;
|
|
10992
|
+
z = z || scaling;
|
|
10993
|
+
scaling = createVec3(scaling, y, z);
|
|
11270
10994
|
}
|
|
11271
10995
|
|
|
11272
|
-
this.
|
|
11273
|
-
return
|
|
11274
|
-
}
|
|
10996
|
+
this.sceneGraphService.scaleLocal(this, scaling);
|
|
10997
|
+
return this;
|
|
10998
|
+
}
|
|
10999
|
+
/**
|
|
11000
|
+
* set scaling in local space
|
|
11001
|
+
*/
|
|
11002
|
+
;
|
|
11275
11003
|
|
|
11276
|
-
_proto.
|
|
11277
|
-
|
|
11004
|
+
_proto.setLocalScale = function setLocalScale(scaling, y, z) {
|
|
11005
|
+
if (typeof scaling === 'number') {
|
|
11006
|
+
y = y || scaling;
|
|
11007
|
+
z = z || scaling;
|
|
11008
|
+
scaling = createVec3(scaling, y, z);
|
|
11009
|
+
}
|
|
11278
11010
|
|
|
11279
|
-
|
|
11280
|
-
|
|
11011
|
+
this.sceneGraphService.setLocalScale(this, scaling);
|
|
11012
|
+
return this;
|
|
11013
|
+
}
|
|
11014
|
+
/**
|
|
11015
|
+
* get scaling in local space
|
|
11016
|
+
*/
|
|
11017
|
+
;
|
|
11281
11018
|
|
|
11282
|
-
|
|
11019
|
+
_proto.getLocalScale = function getLocalScale() {
|
|
11020
|
+
return this.sceneGraphService.getLocalScale(this);
|
|
11021
|
+
}
|
|
11022
|
+
/**
|
|
11023
|
+
* get scaling in world space
|
|
11024
|
+
*/
|
|
11025
|
+
;
|
|
11283
11026
|
|
|
11284
|
-
|
|
11285
|
-
|
|
11286
|
-
}
|
|
11027
|
+
_proto.getScale = function getScale() {
|
|
11028
|
+
return this.sceneGraphService.getScale(this);
|
|
11029
|
+
}
|
|
11030
|
+
/**
|
|
11031
|
+
* only return degrees of Z axis in world space
|
|
11032
|
+
*/
|
|
11033
|
+
;
|
|
11287
11034
|
|
|
11288
|
-
_proto.
|
|
11289
|
-
|
|
11290
|
-
|
|
11291
|
-
|
|
11035
|
+
_proto.getEulerAngles = function getEulerAngles() {
|
|
11036
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11037
|
+
var _getEuler = getEuler(vec3.create(), this.sceneGraphService.getWorldTransform(this)),
|
|
11038
|
+
ex = _getEuler[0],
|
|
11039
|
+
ey = _getEuler[1],
|
|
11040
|
+
ez = _getEuler[2];
|
|
11292
11041
|
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
|
|
11298
|
-
|
|
11299
|
-
var activeAnimations = [];
|
|
11300
|
-
var inactiveAnimations = [];
|
|
11301
|
-
updatingAnimations.forEach(function (animation) {
|
|
11302
|
-
animation.tick(t, isAnimationFrame);
|
|
11042
|
+
return rad2deg(ez);
|
|
11043
|
+
}
|
|
11044
|
+
/**
|
|
11045
|
+
* only return degrees of Z axis in local space
|
|
11046
|
+
*/
|
|
11047
|
+
;
|
|
11303
11048
|
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
}
|
|
11049
|
+
_proto.getLocalEulerAngles = function getLocalEulerAngles() {
|
|
11050
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11051
|
+
var _getEuler2 = getEuler(vec3.create(), this.sceneGraphService.getLocalRotation(this)),
|
|
11052
|
+
ex = _getEuler2[0],
|
|
11053
|
+
ey = _getEuler2[1],
|
|
11054
|
+
ez = _getEuler2[2];
|
|
11311
11055
|
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11056
|
+
return rad2deg(ez);
|
|
11057
|
+
}
|
|
11058
|
+
/**
|
|
11059
|
+
* set euler angles(degrees) in world space
|
|
11060
|
+
*/
|
|
11061
|
+
;
|
|
11315
11062
|
|
|
11316
|
-
|
|
11317
|
-
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
|
|
11321
|
-
|
|
11063
|
+
_proto.setEulerAngles = function setEulerAngles(z) {
|
|
11064
|
+
this.sceneGraphService.setEulerAngles(this, 0, 0, z);
|
|
11065
|
+
return this;
|
|
11066
|
+
}
|
|
11067
|
+
/**
|
|
11068
|
+
* set euler angles(degrees) in local space
|
|
11069
|
+
*/
|
|
11070
|
+
;
|
|
11322
11071
|
|
|
11323
|
-
|
|
11072
|
+
_proto.setLocalEulerAngles = function setLocalEulerAngles(z) {
|
|
11073
|
+
this.sceneGraphService.setLocalEulerAngles(this, 0, 0, z);
|
|
11074
|
+
return this;
|
|
11075
|
+
};
|
|
11324
11076
|
|
|
11325
|
-
|
|
11077
|
+
_proto.rotateLocal = function rotateLocal(x, y, z) {
|
|
11078
|
+
if (isNil(y) && isNil(z)) {
|
|
11079
|
+
this.sceneGraphService.rotateLocal(this, 0, 0, x);
|
|
11080
|
+
} else {
|
|
11081
|
+
this.sceneGraphService.rotateLocal(this, x, y, z);
|
|
11082
|
+
}
|
|
11326
11083
|
|
|
11327
|
-
|
|
11328
|
-
this.inTick = false;
|
|
11329
|
-
return [activeAnimations, inactiveAnimations];
|
|
11084
|
+
return this;
|
|
11330
11085
|
};
|
|
11331
11086
|
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
this.htmlPool = [];
|
|
11339
|
-
}
|
|
11087
|
+
_proto.rotate = function rotate(x, y, z) {
|
|
11088
|
+
if (isNil(y) && isNil(z)) {
|
|
11089
|
+
this.sceneGraphService.rotate(this, 0, 0, x);
|
|
11090
|
+
} else {
|
|
11091
|
+
this.sceneGraphService.rotate(this, x, y, z);
|
|
11092
|
+
}
|
|
11340
11093
|
|
|
11341
|
-
|
|
11094
|
+
return this;
|
|
11095
|
+
};
|
|
11342
11096
|
|
|
11343
|
-
_proto.
|
|
11344
|
-
|
|
11097
|
+
_proto.setRotation = function setRotation(rotation, y, z, w) {
|
|
11098
|
+
this.sceneGraphService.setRotation(this, rotation, y, z, w);
|
|
11099
|
+
return this;
|
|
11345
11100
|
};
|
|
11346
11101
|
|
|
11347
|
-
_proto.
|
|
11348
|
-
this.
|
|
11102
|
+
_proto.setLocalRotation = function setLocalRotation(rotation, y, z, w) {
|
|
11103
|
+
this.sceneGraphService.setLocalRotation(this, rotation, y, z, w);
|
|
11104
|
+
return this;
|
|
11105
|
+
};
|
|
11349
11106
|
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11107
|
+
_proto.setLocalSkew = function setLocalSkew(skew, y) {
|
|
11108
|
+
this.sceneGraphService.setLocalSkew(this, skew, y);
|
|
11109
|
+
return this;
|
|
11353
11110
|
};
|
|
11354
11111
|
|
|
11355
|
-
_proto.
|
|
11356
|
-
|
|
11357
|
-
|
|
11112
|
+
_proto.getRotation = function getRotation() {
|
|
11113
|
+
return this.sceneGraphService.getRotation(this);
|
|
11114
|
+
};
|
|
11358
11115
|
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
this.htmlPool.splice(index, 1);
|
|
11362
|
-
}
|
|
11116
|
+
_proto.getLocalRotation = function getLocalRotation() {
|
|
11117
|
+
return this.sceneGraphService.getLocalRotation(this);
|
|
11363
11118
|
};
|
|
11364
11119
|
|
|
11365
|
-
_proto.
|
|
11366
|
-
return this.
|
|
11120
|
+
_proto.getLocalSkew = function getLocalSkew() {
|
|
11121
|
+
return this.sceneGraphService.getLocalSkew(this);
|
|
11367
11122
|
};
|
|
11368
11123
|
|
|
11369
|
-
|
|
11370
|
-
|
|
11124
|
+
_proto.getLocalTransform = function getLocalTransform() {
|
|
11125
|
+
return this.sceneGraphService.getLocalTransform(this);
|
|
11126
|
+
};
|
|
11371
11127
|
|
|
11372
|
-
|
|
11128
|
+
_proto.getWorldTransform = function getWorldTransform() {
|
|
11129
|
+
return this.sceneGraphService.getWorldTransform(this);
|
|
11130
|
+
};
|
|
11373
11131
|
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
strokeOpacity: '',
|
|
11379
|
-
fill: '',
|
|
11380
|
-
stroke: '',
|
|
11381
|
-
transform: '',
|
|
11382
|
-
transformOrigin: '',
|
|
11383
|
-
visibility: '',
|
|
11384
|
-
pointerEvents: '',
|
|
11385
|
-
lineWidth: '',
|
|
11386
|
-
lineCap: '',
|
|
11387
|
-
lineJoin: '',
|
|
11388
|
-
increasedLineWidthForHitTesting: '',
|
|
11389
|
-
fontSize: '',
|
|
11390
|
-
fontFamily: '',
|
|
11391
|
-
fontStyle: '',
|
|
11392
|
-
fontWeight: '',
|
|
11393
|
-
fontVariant: '',
|
|
11394
|
-
textAlign: '',
|
|
11395
|
-
textBaseline: '',
|
|
11396
|
-
textTransform: '',
|
|
11397
|
-
zIndex: '',
|
|
11398
|
-
filter: ''
|
|
11399
|
-
};
|
|
11400
|
-
/**
|
|
11401
|
-
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
11402
|
-
*
|
|
11403
|
-
* mixins: Animatable, Transformable, Visible
|
|
11404
|
-
* @see https://github.com/tannerntannern/ts-mixer/blob/master/README.md#mixing-generic-classes
|
|
11405
|
-
*
|
|
11406
|
-
* Provide abilities in scene graph, such as:
|
|
11407
|
-
* * transform `translate/rotate/scale`
|
|
11408
|
-
* * add/remove child
|
|
11409
|
-
* * visibility and z-index
|
|
11410
|
-
*
|
|
11411
|
-
* Those abilities are implemented with those components: `Transform/Sortable/Visible`.
|
|
11412
|
-
*
|
|
11413
|
-
* Emit following events:
|
|
11414
|
-
* * init
|
|
11415
|
-
* * destroy
|
|
11416
|
-
* * attributeChanged
|
|
11417
|
-
*/
|
|
11132
|
+
_proto.setLocalTransform = function setLocalTransform(transform) {
|
|
11133
|
+
this.sceneGraphService.setLocalTransform(this, transform);
|
|
11134
|
+
return this;
|
|
11135
|
+
};
|
|
11418
11136
|
|
|
11419
|
-
|
|
11420
|
-
|
|
11137
|
+
_proto.resetLocalTransform = function resetLocalTransform() {
|
|
11138
|
+
this.sceneGraphService.resetLocalTransform(this);
|
|
11139
|
+
} // #endregion transformable
|
|
11140
|
+
// #region animatable
|
|
11421
11141
|
|
|
11422
11142
|
/**
|
|
11423
|
-
*
|
|
11143
|
+
* returns an array of all Animation objects affecting this element
|
|
11144
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAnimations
|
|
11424
11145
|
*/
|
|
11146
|
+
;
|
|
11425
11147
|
|
|
11148
|
+
_proto.getAnimations = function getAnimations() {
|
|
11149
|
+
return this.activeAnimations;
|
|
11150
|
+
}
|
|
11426
11151
|
/**
|
|
11427
|
-
*
|
|
11152
|
+
* create an animation with WAAPI
|
|
11153
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/animate
|
|
11428
11154
|
*/
|
|
11429
|
-
|
|
11430
|
-
var _this$config$capture;
|
|
11155
|
+
;
|
|
11431
11156
|
|
|
11432
|
-
|
|
11157
|
+
_proto.animate = function animate(keyframes, options) {
|
|
11158
|
+
var _this$ownerDocument;
|
|
11433
11159
|
|
|
11434
|
-
_this =
|
|
11435
|
-
// eg. group.get('name')
|
|
11160
|
+
var timeline = (_this$ownerDocument = this.ownerDocument) === null || _this$ownerDocument === void 0 ? void 0 : _this$ownerDocument.timeline; // account for clip path, use target's timeline
|
|
11436
11161
|
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
_this.isCustomElement = false;
|
|
11440
|
-
_this.activeAnimations = [];
|
|
11441
|
-
_this.mutationEvent = new MutationEvent(ElementEvent.ATTR_MODIFIED, _assertThisInitialized(_this), null, null, null, MutationEvent.MODIFICATION, null, null);
|
|
11442
|
-
_this.config = config; // compatible with G 3.0
|
|
11162
|
+
if (this.parsedStyle.clipPathTargets && this.parsedStyle.clipPathTargets.length) {
|
|
11163
|
+
var _target$ownerDocument;
|
|
11443
11164
|
|
|
11444
|
-
|
|
11165
|
+
var target = this.parsedStyle.clipPathTargets[0];
|
|
11166
|
+
timeline = (_target$ownerDocument = target.ownerDocument) === null || _target$ownerDocument === void 0 ? void 0 : _target$ownerDocument.timeline;
|
|
11167
|
+
} // clear old parsed transform
|
|
11445
11168
|
|
|
11446
|
-
_this.id = _this.config.id || '';
|
|
11447
|
-
_this.name = _this.config.name || '';
|
|
11448
11169
|
|
|
11449
|
-
|
|
11450
|
-
|
|
11170
|
+
delete this.parsedStyle.transform;
|
|
11171
|
+
|
|
11172
|
+
if (timeline) {
|
|
11173
|
+
return timeline.play(new KeyframeEffect(this, keyframes, options));
|
|
11451
11174
|
}
|
|
11452
11175
|
|
|
11453
|
-
|
|
11176
|
+
return null;
|
|
11177
|
+
} // #endregion animatable
|
|
11178
|
+
// #region visible
|
|
11454
11179
|
|
|
11455
|
-
|
|
11180
|
+
/**
|
|
11181
|
+
* show group, which will also change visibility of its children in sceneGraphNode
|
|
11182
|
+
*
|
|
11183
|
+
* @deprecated
|
|
11184
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility
|
|
11185
|
+
*/
|
|
11186
|
+
;
|
|
11456
11187
|
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11188
|
+
_proto.show = function show() {
|
|
11189
|
+
this.style.visibility = 'visible';
|
|
11190
|
+
}
|
|
11191
|
+
/**
|
|
11192
|
+
* @deprecated
|
|
11193
|
+
* hide group, which will also change visibility of its children in sceneGraphNode
|
|
11194
|
+
*/
|
|
11195
|
+
;
|
|
11460
11196
|
|
|
11461
|
-
|
|
11462
|
-
|
|
11197
|
+
_proto.hide = function hide() {
|
|
11198
|
+
this.style.visibility = 'hidden';
|
|
11199
|
+
}
|
|
11200
|
+
/**
|
|
11201
|
+
* shortcut for Used value of `visibility`
|
|
11202
|
+
*/
|
|
11203
|
+
;
|
|
11204
|
+
|
|
11205
|
+
_proto.isVisible = function isVisible() {
|
|
11206
|
+
var _this$parsedStyle, _this$parsedStyle$vis;
|
|
11207
|
+
|
|
11208
|
+
return ((_this$parsedStyle = this.parsedStyle) === null || _this$parsedStyle === void 0 ? void 0 : (_this$parsedStyle$vis = _this$parsedStyle.visibility) === null || _this$parsedStyle$vis === void 0 ? void 0 : _this$parsedStyle$vis.value) === 'visible';
|
|
11209
|
+
};
|
|
11210
|
+
|
|
11211
|
+
_proto.isInteractive = function isInteractive() {
|
|
11212
|
+
var _this$parsedStyle2, _this$parsedStyle2$po;
|
|
11213
|
+
|
|
11214
|
+
return ((_this$parsedStyle2 = this.parsedStyle) === null || _this$parsedStyle2 === void 0 ? void 0 : (_this$parsedStyle2$po = _this$parsedStyle2.pointerEvents) === null || _this$parsedStyle2$po === void 0 ? void 0 : _this$parsedStyle2$po.value) !== 'none';
|
|
11215
|
+
};
|
|
11216
|
+
|
|
11217
|
+
_proto.isCulled = function isCulled() {
|
|
11218
|
+
return !!(this.cullable && this.cullable.isCulled());
|
|
11219
|
+
}
|
|
11220
|
+
/**
|
|
11221
|
+
* bring to front in current group
|
|
11222
|
+
*/
|
|
11223
|
+
;
|
|
11224
|
+
|
|
11225
|
+
_proto.toFront = function toFront() {
|
|
11226
|
+
if (this.parentNode) {
|
|
11227
|
+
this.style.zIndex = Math.max.apply(Math, this.parentNode.children.map(function (child) {
|
|
11228
|
+
return Number(child.style.zIndex);
|
|
11229
|
+
})) + 1;
|
|
11463
11230
|
}
|
|
11464
11231
|
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
},
|
|
11472
|
-
removeProperty: function removeProperty(propertyName) {
|
|
11473
|
-
_this.removeAttribute(propertyName);
|
|
11474
|
-
},
|
|
11475
|
-
item: function item() {
|
|
11476
|
-
return '';
|
|
11477
|
-
}
|
|
11478
|
-
}), {
|
|
11479
|
-
get: function get(target, name) {
|
|
11480
|
-
if (target[name] !== undefined) {
|
|
11481
|
-
// if (name in target) {
|
|
11482
|
-
return target[name];
|
|
11483
|
-
}
|
|
11232
|
+
return this;
|
|
11233
|
+
}
|
|
11234
|
+
/**
|
|
11235
|
+
* send to back in current group
|
|
11236
|
+
*/
|
|
11237
|
+
;
|
|
11484
11238
|
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11239
|
+
_proto.toBack = function toBack() {
|
|
11240
|
+
if (this.parentNode) {
|
|
11241
|
+
this.style.zIndex = Math.min.apply(Math, this.parentNode.children.map(function (child) {
|
|
11242
|
+
return Number(child.style.zIndex);
|
|
11243
|
+
})) - 1;
|
|
11244
|
+
}
|
|
11489
11245
|
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11246
|
+
return this;
|
|
11247
|
+
} // #endregion visible
|
|
11248
|
+
// #region deprecated
|
|
11493
11249
|
|
|
11494
|
-
|
|
11250
|
+
/**
|
|
11251
|
+
* @deprecated
|
|
11252
|
+
* compatible with G 3.0
|
|
11253
|
+
* @deprecated
|
|
11254
|
+
*/
|
|
11255
|
+
;
|
|
11495
11256
|
|
|
11257
|
+
_proto.getCount = function getCount() {
|
|
11258
|
+
return this.childElementCount;
|
|
11259
|
+
}
|
|
11260
|
+
/**
|
|
11261
|
+
* @deprecated
|
|
11262
|
+
* compatible with G 3.0
|
|
11263
|
+
* @deprecated
|
|
11264
|
+
*/
|
|
11265
|
+
;
|
|
11496
11266
|
|
|
11497
|
-
|
|
11498
|
-
return
|
|
11267
|
+
_proto.getParent = function getParent() {
|
|
11268
|
+
return this.parentElement;
|
|
11499
11269
|
}
|
|
11270
|
+
/**
|
|
11271
|
+
* @deprecated
|
|
11272
|
+
* compatible with G 3.0
|
|
11273
|
+
* @deprecated
|
|
11274
|
+
*/
|
|
11275
|
+
;
|
|
11500
11276
|
|
|
11501
|
-
|
|
11277
|
+
_proto.getChildren = function getChildren() {
|
|
11278
|
+
return this.children;
|
|
11279
|
+
}
|
|
11280
|
+
/**
|
|
11281
|
+
* @deprecated
|
|
11282
|
+
* compatible with G 3.0
|
|
11283
|
+
* @deprecated
|
|
11284
|
+
*/
|
|
11285
|
+
;
|
|
11502
11286
|
|
|
11503
|
-
_proto.
|
|
11504
|
-
|
|
11287
|
+
_proto.getFirst = function getFirst() {
|
|
11288
|
+
return this.firstElementChild;
|
|
11289
|
+
}
|
|
11290
|
+
/**
|
|
11291
|
+
* @deprecated
|
|
11292
|
+
* compatible with G 3.0
|
|
11293
|
+
* @deprecated
|
|
11294
|
+
* get last child group/shape
|
|
11295
|
+
*/
|
|
11296
|
+
;
|
|
11505
11297
|
|
|
11298
|
+
_proto.getLast = function getLast() {
|
|
11299
|
+
return this.lastElementChild;
|
|
11300
|
+
}
|
|
11301
|
+
/**
|
|
11302
|
+
* @deprecated
|
|
11303
|
+
* compatible with G 3.0
|
|
11304
|
+
* @deprecated
|
|
11305
|
+
* get child group/shape by index
|
|
11306
|
+
*/
|
|
11307
|
+
;
|
|
11506
11308
|
|
|
11507
|
-
|
|
11309
|
+
_proto.getChildByIndex = function getChildByIndex(index) {
|
|
11310
|
+
return this.children[index] || null;
|
|
11311
|
+
}
|
|
11312
|
+
/**
|
|
11313
|
+
* compatible with G 3.0
|
|
11314
|
+
* @deprecated
|
|
11315
|
+
*/
|
|
11316
|
+
;
|
|
11508
11317
|
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11318
|
+
_proto.add = function add(child, index) {
|
|
11319
|
+
return this.appendChild(child, index);
|
|
11320
|
+
}
|
|
11321
|
+
/**
|
|
11322
|
+
* @alias style.clipPath
|
|
11323
|
+
* @deprecated
|
|
11324
|
+
*/
|
|
11325
|
+
;
|
|
11513
11326
|
|
|
11514
|
-
_proto.
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
style: _extends({}, this.attributes)
|
|
11523
|
-
}); // apply transform
|
|
11327
|
+
_proto.setClip = function setClip(clipPath) {
|
|
11328
|
+
this.style.clipPath = clipPath;
|
|
11329
|
+
}
|
|
11330
|
+
/**
|
|
11331
|
+
* @alias style.clipPath
|
|
11332
|
+
* @deprecated
|
|
11333
|
+
*/
|
|
11334
|
+
;
|
|
11524
11335
|
|
|
11525
|
-
|
|
11336
|
+
_proto.getClip = function getClip() {
|
|
11337
|
+
return this.style.clipPath || null;
|
|
11338
|
+
}
|
|
11339
|
+
/**
|
|
11340
|
+
* compatible with G 3.0
|
|
11341
|
+
* @deprecated
|
|
11342
|
+
*/
|
|
11343
|
+
;
|
|
11526
11344
|
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11345
|
+
_proto.set = function set(name, value) {
|
|
11346
|
+
this.config[name] = value;
|
|
11347
|
+
}
|
|
11348
|
+
/**
|
|
11349
|
+
* compatible with G 3.0
|
|
11350
|
+
* @deprecated
|
|
11351
|
+
*/
|
|
11352
|
+
;
|
|
11533
11353
|
|
|
11534
|
-
|
|
11354
|
+
_proto.get = function get(name) {
|
|
11355
|
+
return this.config[name];
|
|
11356
|
+
}
|
|
11357
|
+
/**
|
|
11358
|
+
* compatible with G 3.0
|
|
11359
|
+
* @alias object.config
|
|
11360
|
+
* @deprecated
|
|
11361
|
+
*/
|
|
11362
|
+
;
|
|
11363
|
+
|
|
11364
|
+
_proto.getConfig = function getConfig() {
|
|
11365
|
+
return this.config;
|
|
11535
11366
|
};
|
|
11536
11367
|
|
|
11537
|
-
_proto.
|
|
11538
|
-
|
|
11539
|
-
|
|
11368
|
+
_proto.attr = function attr() {
|
|
11369
|
+
var _this3 = this;
|
|
11370
|
+
|
|
11371
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11372
|
+
args[_key] = arguments[_key];
|
|
11540
11373
|
}
|
|
11541
11374
|
|
|
11542
|
-
var
|
|
11543
|
-
|
|
11375
|
+
var name = args[0],
|
|
11376
|
+
value = args[1];
|
|
11544
11377
|
|
|
11545
|
-
|
|
11546
|
-
|
|
11378
|
+
if (!name) {
|
|
11379
|
+
return this.attributes;
|
|
11380
|
+
}
|
|
11547
11381
|
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11382
|
+
if (isObject(name)) {
|
|
11383
|
+
Object.keys(name).forEach(function (key) {
|
|
11384
|
+
_this3.setAttribute(key, name[key]);
|
|
11385
|
+
});
|
|
11386
|
+
return this;
|
|
11551
11387
|
}
|
|
11552
11388
|
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
|
|
11389
|
+
if (args.length === 2) {
|
|
11390
|
+
this.setAttribute(name, value);
|
|
11391
|
+
return this;
|
|
11392
|
+
}
|
|
11556
11393
|
|
|
11394
|
+
return this.attributes[name];
|
|
11395
|
+
}
|
|
11396
|
+
/**
|
|
11397
|
+
* @alias setPosition
|
|
11398
|
+
* @deprecated
|
|
11399
|
+
*/
|
|
11400
|
+
;
|
|
11557
11401
|
|
|
11558
|
-
|
|
11559
|
-
|
|
11402
|
+
_proto.moveTo = function moveTo(position, y, z) {
|
|
11403
|
+
if (y === void 0) {
|
|
11404
|
+
y = 0;
|
|
11560
11405
|
}
|
|
11561
11406
|
|
|
11562
|
-
if (
|
|
11563
|
-
|
|
11564
|
-
|
|
11565
|
-
_Element.prototype.setAttribute.call(this, attributeName, attributeValue);
|
|
11407
|
+
if (z === void 0) {
|
|
11408
|
+
z = 0;
|
|
11566
11409
|
}
|
|
11410
|
+
|
|
11411
|
+
this.setPosition(position, y, z);
|
|
11412
|
+
return this;
|
|
11567
11413
|
}
|
|
11568
11414
|
/**
|
|
11569
|
-
*
|
|
11415
|
+
* @alias setPosition
|
|
11416
|
+
* @deprecated
|
|
11570
11417
|
*/
|
|
11571
11418
|
;
|
|
11572
11419
|
|
|
11573
|
-
_proto.
|
|
11574
|
-
|
|
11575
|
-
|
|
11420
|
+
_proto.move = function move(position, y, z) {
|
|
11421
|
+
if (y === void 0) {
|
|
11422
|
+
y = 0;
|
|
11423
|
+
}
|
|
11576
11424
|
|
|
11577
|
-
if (
|
|
11578
|
-
|
|
11425
|
+
if (z === void 0) {
|
|
11426
|
+
z = 0;
|
|
11579
11427
|
}
|
|
11580
11428
|
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11429
|
+
this.setPosition(position, y, z);
|
|
11430
|
+
return this;
|
|
11431
|
+
}
|
|
11432
|
+
/**
|
|
11433
|
+
* @alias style.zIndex
|
|
11434
|
+
* @deprecated
|
|
11435
|
+
*/
|
|
11436
|
+
;
|
|
11585
11437
|
|
|
11586
|
-
|
|
11587
|
-
|
|
11588
|
-
|
|
11438
|
+
_proto.setZIndex = function setZIndex(zIndex) {
|
|
11439
|
+
this.style.zIndex = zIndex;
|
|
11440
|
+
return this;
|
|
11441
|
+
}
|
|
11442
|
+
/**
|
|
11443
|
+
* return 3x3 matrix in world space
|
|
11444
|
+
* @deprecated
|
|
11445
|
+
*/
|
|
11446
|
+
;
|
|
11589
11447
|
|
|
11590
|
-
|
|
11448
|
+
_proto.getMatrix = function getMatrix(transformMat4) {
|
|
11449
|
+
var transform = transformMat4 || this.getWorldTransform();
|
|
11591
11450
|
|
|
11592
|
-
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
}
|
|
11596
|
-
}
|
|
11597
|
-
});
|
|
11598
|
-
} // redraw at next frame
|
|
11451
|
+
var _mat4$getTranslation = mat4.getTranslation(vec3.create(), transform),
|
|
11452
|
+
tx = _mat4$getTranslation[0],
|
|
11453
|
+
ty = _mat4$getTranslation[1];
|
|
11599
11454
|
|
|
11455
|
+
var _mat4$getScaling = mat4.getScaling(vec3.create(), transform),
|
|
11456
|
+
sx = _mat4$getScaling[0],
|
|
11457
|
+
sy = _mat4$getScaling[1];
|
|
11600
11458
|
|
|
11601
|
-
|
|
11602
|
-
// this.sceneGraphService.pendingEvents.push([ElementEvent.ATTR_MODIFIED, { affectChildren }]);
|
|
11459
|
+
var rotation = mat4.getRotation(quat$1.create(), transform); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11603
11460
|
|
|
11604
|
-
|
|
11605
|
-
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
this.mutationEvent.newParsedValue = this.parsedStyle[name];
|
|
11609
|
-
this.dispatchEvent(this.mutationEvent);
|
|
11461
|
+
var _getEuler3 = getEuler(vec3.create(), rotation),
|
|
11462
|
+
eux = _getEuler3[0],
|
|
11463
|
+
euy = _getEuler3[1],
|
|
11464
|
+
euz = _getEuler3[2]; // gimbal lock at 90 degrees
|
|
11610
11465
|
|
|
11611
|
-
if (this.isCustomElement && this.isConnected) {
|
|
11612
|
-
if (this.attributeChangedCallback) {
|
|
11613
|
-
this.attributeChangedCallback(name, oldValue, value);
|
|
11614
|
-
}
|
|
11615
|
-
}
|
|
11616
|
-
} // #region transformable
|
|
11617
11466
|
|
|
11467
|
+
return fromRotationTranslationScale(eux || euz, tx, ty, sx, sy);
|
|
11468
|
+
}
|
|
11618
11469
|
/**
|
|
11619
|
-
*
|
|
11620
|
-
* @
|
|
11621
|
-
*
|
|
11622
|
-
* FIXME: It is worth noting that getBBox responds to original untransformed values of a drawn object.
|
|
11623
|
-
* @see https://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html#getBBox
|
|
11470
|
+
* return 3x3 matrix in local space
|
|
11471
|
+
* @deprecated
|
|
11624
11472
|
*/
|
|
11625
11473
|
;
|
|
11626
11474
|
|
|
11627
|
-
_proto.
|
|
11628
|
-
|
|
11475
|
+
_proto.getLocalMatrix = function getLocalMatrix() {
|
|
11476
|
+
return this.getMatrix(this.getLocalTransform());
|
|
11477
|
+
}
|
|
11478
|
+
/**
|
|
11479
|
+
* set 3x3 matrix in world space
|
|
11480
|
+
* @deprecated
|
|
11481
|
+
*/
|
|
11482
|
+
;
|
|
11629
11483
|
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11484
|
+
_proto.setMatrix = function setMatrix(mat) {
|
|
11485
|
+
var _decompose = decompose(mat),
|
|
11486
|
+
tx = _decompose[0],
|
|
11487
|
+
ty = _decompose[1],
|
|
11488
|
+
scalingX = _decompose[2],
|
|
11489
|
+
scalingY = _decompose[3],
|
|
11490
|
+
angle = _decompose[4];
|
|
11633
11491
|
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11492
|
+
this.setEulerAngles(angle).setPosition(tx, ty).setLocalScale(scalingX, scalingY);
|
|
11493
|
+
}
|
|
11494
|
+
/**
|
|
11495
|
+
* set 3x3 matrix in local space
|
|
11496
|
+
* @deprecated
|
|
11497
|
+
*/
|
|
11498
|
+
;
|
|
11637
11499
|
|
|
11638
|
-
|
|
11500
|
+
_proto.setLocalMatrix = function setLocalMatrix(mat) {
|
|
11501
|
+
var _decompose2 = decompose(mat),
|
|
11502
|
+
tx = _decompose2[0],
|
|
11503
|
+
ty = _decompose2[1],
|
|
11504
|
+
scalingX = _decompose2[2],
|
|
11505
|
+
scalingY = _decompose2[3],
|
|
11506
|
+
angle = _decompose2[4];
|
|
11507
|
+
|
|
11508
|
+
this.setLocalEulerAngles(angle).setLocalPosition(tx, ty).setLocalScale(scalingX, scalingY);
|
|
11639
11509
|
};
|
|
11640
11510
|
|
|
11641
|
-
|
|
11642
|
-
|
|
11643
|
-
|
|
11511
|
+
_createClass(DisplayObject, [{
|
|
11512
|
+
key: "interactive",
|
|
11513
|
+
get: function get() {
|
|
11514
|
+
return this.isInteractive();
|
|
11515
|
+
},
|
|
11516
|
+
set: function set(b) {
|
|
11517
|
+
this.style.pointerEvents = b ? 'auto' : 'none';
|
|
11644
11518
|
}
|
|
11519
|
+
}]);
|
|
11520
|
+
|
|
11521
|
+
return DisplayObject;
|
|
11522
|
+
}(Element);
|
|
11523
|
+
|
|
11524
|
+
var _excluded = ["style"];
|
|
11525
|
+
/**
|
|
11526
|
+
* shadow root
|
|
11527
|
+
* @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
|
|
11528
|
+
*/
|
|
11529
|
+
|
|
11530
|
+
var CustomElement = /*#__PURE__*/function (_DisplayObject) {
|
|
11531
|
+
_inheritsLoose(CustomElement, _DisplayObject);
|
|
11532
|
+
|
|
11533
|
+
// static get observedAttributes(): string[] {
|
|
11534
|
+
// return [];
|
|
11535
|
+
// }
|
|
11536
|
+
// private shadowNodes: DisplayObject[] = [];
|
|
11537
|
+
function CustomElement(_temp) {
|
|
11538
|
+
var _this;
|
|
11539
|
+
|
|
11540
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
11541
|
+
style = _ref.style,
|
|
11542
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
11543
|
+
|
|
11544
|
+
_this = _DisplayObject.call(this, _extends({
|
|
11545
|
+
style: _extends({
|
|
11546
|
+
x: '',
|
|
11547
|
+
y: ''
|
|
11548
|
+
}, style)
|
|
11549
|
+
}, rest)) || this;
|
|
11550
|
+
_this.isCustomElement = true;
|
|
11551
|
+
return _this;
|
|
11552
|
+
}
|
|
11553
|
+
|
|
11554
|
+
return CustomElement;
|
|
11555
|
+
}(DisplayObject);
|
|
11556
|
+
|
|
11557
|
+
var _excluded$1 = ["style"];
|
|
11558
|
+
var Circle = /*#__PURE__*/function (_DisplayObject) {
|
|
11559
|
+
_inheritsLoose(Circle, _DisplayObject);
|
|
11560
|
+
|
|
11561
|
+
function Circle(_temp) {
|
|
11562
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
11563
|
+
style = _ref.style,
|
|
11564
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
11565
|
+
|
|
11566
|
+
return _DisplayObject.call(this, _extends({
|
|
11567
|
+
type: Shape.CIRCLE,
|
|
11568
|
+
style: _extends({
|
|
11569
|
+
cx: '',
|
|
11570
|
+
cy: '',
|
|
11571
|
+
r: ''
|
|
11572
|
+
}, style)
|
|
11573
|
+
}, rest)) || this;
|
|
11574
|
+
}
|
|
11575
|
+
|
|
11576
|
+
return Circle;
|
|
11577
|
+
}(DisplayObject);
|
|
11645
11578
|
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11579
|
+
var _excluded$2 = ["style"];
|
|
11580
|
+
var Ellipse = /*#__PURE__*/function (_DisplayObject) {
|
|
11581
|
+
_inheritsLoose(Ellipse, _DisplayObject);
|
|
11649
11582
|
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
11583
|
+
function Ellipse(_temp) {
|
|
11584
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
11585
|
+
style = _ref.style,
|
|
11586
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
11653
11587
|
|
|
11654
|
-
|
|
11655
|
-
|
|
11588
|
+
return _DisplayObject.call(this, _extends({
|
|
11589
|
+
type: Shape.ELLIPSE,
|
|
11590
|
+
style: _extends({
|
|
11591
|
+
cx: '',
|
|
11592
|
+
cy: '',
|
|
11593
|
+
rx: '',
|
|
11594
|
+
ry: ''
|
|
11595
|
+
}, style)
|
|
11596
|
+
}, rest)) || this;
|
|
11656
11597
|
}
|
|
11657
|
-
/**
|
|
11658
|
-
* set position in world space
|
|
11659
|
-
*/
|
|
11660
|
-
;
|
|
11661
|
-
|
|
11662
|
-
_proto.setPosition = function setPosition(position, y, z) {
|
|
11663
|
-
if (y === void 0) {
|
|
11664
|
-
y = 0;
|
|
11665
|
-
}
|
|
11666
11598
|
|
|
11667
|
-
|
|
11668
|
-
|
|
11669
|
-
}
|
|
11599
|
+
return Ellipse;
|
|
11600
|
+
}(DisplayObject);
|
|
11670
11601
|
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
|
|
11674
|
-
|
|
11675
|
-
|
|
11676
|
-
|
|
11677
|
-
|
|
11602
|
+
var _excluded$3 = ["style"];
|
|
11603
|
+
/**
|
|
11604
|
+
* its attributes are inherited by its children.
|
|
11605
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/g
|
|
11606
|
+
*
|
|
11607
|
+
* @example
|
|
11608
|
+
* <g fill="white" stroke="green" stroke-width="5">
|
|
11609
|
+
<circle cx="40" cy="40" r="25" />
|
|
11610
|
+
<circle cx="60" cy="60" r="25" />
|
|
11611
|
+
</g>
|
|
11612
|
+
*/
|
|
11678
11613
|
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
y = 0;
|
|
11682
|
-
}
|
|
11614
|
+
var Group = /*#__PURE__*/function (_DisplayObject) {
|
|
11615
|
+
_inheritsLoose(Group, _DisplayObject);
|
|
11683
11616
|
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11617
|
+
function Group(_temp) {
|
|
11618
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
11619
|
+
style = _ref.style,
|
|
11620
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
11687
11621
|
|
|
11688
|
-
|
|
11689
|
-
|
|
11622
|
+
return _DisplayObject.call(this, _extends({
|
|
11623
|
+
type: Shape.GROUP,
|
|
11624
|
+
style: _extends({
|
|
11625
|
+
x: '',
|
|
11626
|
+
y: '',
|
|
11627
|
+
width: '',
|
|
11628
|
+
height: ''
|
|
11629
|
+
}, style)
|
|
11630
|
+
}, rest)) || this;
|
|
11690
11631
|
}
|
|
11691
|
-
/**
|
|
11692
|
-
* translate in world space
|
|
11693
|
-
*/
|
|
11694
|
-
;
|
|
11695
11632
|
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
y = 0;
|
|
11699
|
-
}
|
|
11633
|
+
return Group;
|
|
11634
|
+
}(DisplayObject);
|
|
11700
11635
|
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11636
|
+
var _excluded$4 = ["style"];
|
|
11637
|
+
var Image = /*#__PURE__*/function (_DisplayObject) {
|
|
11638
|
+
_inheritsLoose(Image, _DisplayObject);
|
|
11704
11639
|
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
* translate in local space
|
|
11710
|
-
*/
|
|
11711
|
-
;
|
|
11640
|
+
function Image(_temp) {
|
|
11641
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
11642
|
+
style = _ref.style,
|
|
11643
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
11712
11644
|
|
|
11713
|
-
|
|
11714
|
-
|
|
11715
|
-
|
|
11716
|
-
|
|
11645
|
+
return _DisplayObject.call(this, _extends({
|
|
11646
|
+
type: Shape.IMAGE,
|
|
11647
|
+
style: _extends({
|
|
11648
|
+
x: '',
|
|
11649
|
+
y: '',
|
|
11650
|
+
img: '',
|
|
11651
|
+
width: '',
|
|
11652
|
+
height: ''
|
|
11653
|
+
}, style)
|
|
11654
|
+
}, rest)) || this;
|
|
11655
|
+
}
|
|
11717
11656
|
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
}
|
|
11657
|
+
return Image;
|
|
11658
|
+
}(DisplayObject);
|
|
11721
11659
|
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11660
|
+
var _excluded$5 = ["style"];
|
|
11661
|
+
var Line = /*#__PURE__*/function (_DisplayObject) {
|
|
11662
|
+
_inheritsLoose(Line, _DisplayObject);
|
|
11725
11663
|
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11664
|
+
function Line(_temp) {
|
|
11665
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
11666
|
+
style = _ref.style,
|
|
11667
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
11729
11668
|
|
|
11730
|
-
|
|
11731
|
-
|
|
11669
|
+
return _DisplayObject.call(this, _extends({
|
|
11670
|
+
type: Shape.LINE,
|
|
11671
|
+
style: _extends({
|
|
11672
|
+
x1: 0,
|
|
11673
|
+
y1: 0,
|
|
11674
|
+
x2: 0,
|
|
11675
|
+
y2: 0,
|
|
11676
|
+
z1: 0,
|
|
11677
|
+
z2: 0,
|
|
11678
|
+
isBillboard: false
|
|
11679
|
+
}, style)
|
|
11680
|
+
}, rest)) || this;
|
|
11732
11681
|
}
|
|
11733
|
-
/**
|
|
11734
|
-
* compatible with G 3.0
|
|
11735
|
-
*
|
|
11736
|
-
* scaling in local space
|
|
11737
|
-
* scale(10) = scale(10, 10, 10)
|
|
11738
|
-
*
|
|
11739
|
-
* we can't set scale in world space
|
|
11740
|
-
*/
|
|
11741
|
-
;
|
|
11742
11682
|
|
|
11743
|
-
_proto
|
|
11744
|
-
return this.scaleLocal(scaling, y, z);
|
|
11745
|
-
};
|
|
11683
|
+
var _proto = Line.prototype;
|
|
11746
11684
|
|
|
11747
|
-
_proto.
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11685
|
+
_proto.getPoint = function getPoint(ratio) {
|
|
11686
|
+
// TODO: account for z1/z2 in 3D line
|
|
11687
|
+
var _this$parsedStyle = this.parsedStyle,
|
|
11688
|
+
x1 = _this$parsedStyle.x1,
|
|
11689
|
+
y1 = _this$parsedStyle.y1,
|
|
11690
|
+
x2 = _this$parsedStyle.x2,
|
|
11691
|
+
y2 = _this$parsedStyle.y2,
|
|
11692
|
+
defX = _this$parsedStyle.defX,
|
|
11693
|
+
defY = _this$parsedStyle.defY;
|
|
11753
11694
|
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
/**
|
|
11758
|
-
* set scaling in local space
|
|
11759
|
-
*/
|
|
11760
|
-
;
|
|
11695
|
+
var _LineUtil$pointAt = Line$1.pointAt(x1.value, y1.value, x2.value, y2.value, ratio),
|
|
11696
|
+
x = _LineUtil$pointAt.x,
|
|
11697
|
+
y = _LineUtil$pointAt.y;
|
|
11761
11698
|
|
|
11762
|
-
|
|
11763
|
-
if (typeof scaling === 'number') {
|
|
11764
|
-
y = y || scaling;
|
|
11765
|
-
z = z || scaling;
|
|
11766
|
-
scaling = createVec3(scaling, y, z);
|
|
11767
|
-
}
|
|
11699
|
+
var transformed = vec3.transformMat4(vec3.create(), vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
|
|
11768
11700
|
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
}
|
|
11772
|
-
/**
|
|
11773
|
-
* get scaling in local space
|
|
11774
|
-
*/
|
|
11775
|
-
;
|
|
11701
|
+
return new Point(transformed[0], transformed[1]);
|
|
11702
|
+
};
|
|
11776
11703
|
|
|
11777
|
-
_proto.
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
|
|
11781
|
-
|
|
11782
|
-
|
|
11783
|
-
|
|
11704
|
+
_proto.getTotalLength = function getTotalLength() {
|
|
11705
|
+
// TODO: account for z1/z2 in 3D line
|
|
11706
|
+
var _this$parsedStyle2 = this.parsedStyle,
|
|
11707
|
+
x1 = _this$parsedStyle2.x1,
|
|
11708
|
+
y1 = _this$parsedStyle2.y1,
|
|
11709
|
+
x2 = _this$parsedStyle2.x2,
|
|
11710
|
+
y2 = _this$parsedStyle2.y2;
|
|
11711
|
+
return Line$1.length(x1.value, y1.value, x2.value, y2.value);
|
|
11712
|
+
};
|
|
11784
11713
|
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
}
|
|
11788
|
-
/**
|
|
11789
|
-
* only return degrees of Z axis in world space
|
|
11790
|
-
*/
|
|
11791
|
-
;
|
|
11714
|
+
return Line;
|
|
11715
|
+
}(DisplayObject);
|
|
11792
11716
|
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
ex = _getEuler[0],
|
|
11797
|
-
ey = _getEuler[1],
|
|
11798
|
-
ez = _getEuler[2];
|
|
11717
|
+
var _excluded$6 = ["style"];
|
|
11718
|
+
var Path = /*#__PURE__*/function (_DisplayObject) {
|
|
11719
|
+
_inheritsLoose(Path, _DisplayObject);
|
|
11799
11720
|
|
|
11800
|
-
|
|
11721
|
+
function Path(_temp) {
|
|
11722
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
11723
|
+
style = _ref.style,
|
|
11724
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
11725
|
+
|
|
11726
|
+
return _DisplayObject.call(this, _extends({
|
|
11727
|
+
type: Shape.PATH,
|
|
11728
|
+
style: _extends({
|
|
11729
|
+
path: '',
|
|
11730
|
+
miterLimit: ''
|
|
11731
|
+
}, style)
|
|
11732
|
+
}, rest)) || this;
|
|
11801
11733
|
}
|
|
11802
|
-
/**
|
|
11803
|
-
* only return degrees of Z axis in local space
|
|
11804
|
-
*/
|
|
11805
|
-
;
|
|
11806
11734
|
|
|
11807
|
-
_proto
|
|
11808
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11809
|
-
var _getEuler2 = getEuler(vec3.create(), this.sceneGraphService.getLocalRotation(this)),
|
|
11810
|
-
ex = _getEuler2[0],
|
|
11811
|
-
ey = _getEuler2[1],
|
|
11812
|
-
ez = _getEuler2[2];
|
|
11735
|
+
var _proto = Path.prototype;
|
|
11813
11736
|
|
|
11814
|
-
|
|
11737
|
+
_proto.getTotalLength = function getTotalLength() {
|
|
11738
|
+
return this.parsedStyle.path.totalLength;
|
|
11815
11739
|
}
|
|
11816
11740
|
/**
|
|
11817
|
-
*
|
|
11741
|
+
* Get point according to ratio
|
|
11818
11742
|
*/
|
|
11819
11743
|
;
|
|
11820
11744
|
|
|
11821
|
-
_proto.
|
|
11822
|
-
this.
|
|
11823
|
-
|
|
11745
|
+
_proto.getPoint = function getPoint(ratio) {
|
|
11746
|
+
var _this$parsedStyle = this.parsedStyle,
|
|
11747
|
+
defX = _this$parsedStyle.defX,
|
|
11748
|
+
defY = _this$parsedStyle.defY,
|
|
11749
|
+
_this$parsedStyle$pat = _this$parsedStyle.path,
|
|
11750
|
+
totalLength = _this$parsedStyle$pat.totalLength,
|
|
11751
|
+
absolutePath = _this$parsedStyle$pat.absolutePath;
|
|
11752
|
+
|
|
11753
|
+
var _getPointAtLength = getPointAtLength(absolutePath, ratio * totalLength),
|
|
11754
|
+
x = _getPointAtLength.x,
|
|
11755
|
+
y = _getPointAtLength.y;
|
|
11756
|
+
|
|
11757
|
+
var transformed = vec3.transformMat4(vec3.create(), vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
|
|
11758
|
+
|
|
11759
|
+
return new Point(transformed[0], transformed[1]);
|
|
11824
11760
|
}
|
|
11825
11761
|
/**
|
|
11826
|
-
*
|
|
11762
|
+
* Get start tangent vector
|
|
11827
11763
|
*/
|
|
11828
11764
|
;
|
|
11829
11765
|
|
|
11830
|
-
_proto.
|
|
11831
|
-
this.
|
|
11832
|
-
|
|
11833
|
-
};
|
|
11834
|
-
|
|
11835
|
-
_proto.rotateLocal = function rotateLocal(x, y, z) {
|
|
11836
|
-
if (isNil(y) && isNil(z)) {
|
|
11837
|
-
this.sceneGraphService.rotateLocal(this, 0, 0, x);
|
|
11838
|
-
} else {
|
|
11839
|
-
this.sceneGraphService.rotateLocal(this, x, y, z);
|
|
11840
|
-
}
|
|
11766
|
+
_proto.getStartTangent = function getStartTangent() {
|
|
11767
|
+
var segments = this.parsedStyle.path.segments;
|
|
11768
|
+
var result = [];
|
|
11841
11769
|
|
|
11842
|
-
|
|
11843
|
-
|
|
11770
|
+
if (segments.length > 1) {
|
|
11771
|
+
var startPoint = segments[0].currentPoint;
|
|
11772
|
+
var endPoint = segments[1].currentPoint;
|
|
11773
|
+
var tangent = segments[1].startTangent;
|
|
11774
|
+
result = [];
|
|
11844
11775
|
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11776
|
+
if (tangent) {
|
|
11777
|
+
result.push([startPoint[0] - tangent[0], startPoint[1] - tangent[1]]);
|
|
11778
|
+
result.push([startPoint[0], startPoint[1]]);
|
|
11779
|
+
} else {
|
|
11780
|
+
result.push([endPoint[0], endPoint[1]]);
|
|
11781
|
+
result.push([startPoint[0], startPoint[1]]);
|
|
11782
|
+
}
|
|
11850
11783
|
}
|
|
11851
11784
|
|
|
11852
|
-
return
|
|
11853
|
-
}
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
};
|
|
11859
|
-
|
|
11860
|
-
_proto.setLocalRotation = function setLocalRotation(rotation, y, z, w) {
|
|
11861
|
-
this.sceneGraphService.setLocalRotation(this, rotation, y, z, w);
|
|
11862
|
-
return this;
|
|
11863
|
-
};
|
|
11864
|
-
|
|
11865
|
-
_proto.setLocalSkew = function setLocalSkew(skew, y) {
|
|
11866
|
-
this.sceneGraphService.setLocalSkew(this, skew, y);
|
|
11867
|
-
return this;
|
|
11868
|
-
};
|
|
11869
|
-
|
|
11870
|
-
_proto.getRotation = function getRotation() {
|
|
11871
|
-
return this.sceneGraphService.getRotation(this);
|
|
11872
|
-
};
|
|
11785
|
+
return result;
|
|
11786
|
+
}
|
|
11787
|
+
/**
|
|
11788
|
+
* Get end tangent vector
|
|
11789
|
+
*/
|
|
11790
|
+
;
|
|
11873
11791
|
|
|
11874
|
-
_proto.
|
|
11875
|
-
|
|
11876
|
-
|
|
11792
|
+
_proto.getEndTangent = function getEndTangent() {
|
|
11793
|
+
var segments = this.parsedStyle.path.segments;
|
|
11794
|
+
var length = segments.length;
|
|
11795
|
+
var result = [];
|
|
11877
11796
|
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11797
|
+
if (length > 1) {
|
|
11798
|
+
var startPoint = segments[length - 2].currentPoint;
|
|
11799
|
+
var endPoint = segments[length - 1].currentPoint;
|
|
11800
|
+
var tangent = segments[length - 1].endTangent;
|
|
11801
|
+
result = [];
|
|
11881
11802
|
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
|
|
11803
|
+
if (tangent) {
|
|
11804
|
+
result.push([endPoint[0] - tangent[0], endPoint[1] - tangent[1]]);
|
|
11805
|
+
result.push([endPoint[0], endPoint[1]]);
|
|
11806
|
+
} else {
|
|
11807
|
+
result.push([startPoint[0], startPoint[1]]);
|
|
11808
|
+
result.push([endPoint[0], endPoint[1]]);
|
|
11809
|
+
}
|
|
11810
|
+
}
|
|
11885
11811
|
|
|
11886
|
-
|
|
11887
|
-
return this.sceneGraphService.getWorldTransform(this);
|
|
11812
|
+
return result;
|
|
11888
11813
|
};
|
|
11889
11814
|
|
|
11890
|
-
|
|
11891
|
-
|
|
11892
|
-
return this;
|
|
11893
|
-
};
|
|
11815
|
+
return Path;
|
|
11816
|
+
}(DisplayObject);
|
|
11894
11817
|
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
// #region animatable
|
|
11818
|
+
var _excluded$7 = ["style"];
|
|
11819
|
+
var Polygon = /*#__PURE__*/function (_DisplayObject) {
|
|
11820
|
+
_inheritsLoose(Polygon, _DisplayObject);
|
|
11899
11821
|
|
|
11900
|
-
|
|
11901
|
-
|
|
11902
|
-
|
|
11903
|
-
|
|
11904
|
-
;
|
|
11822
|
+
function Polygon(_temp) {
|
|
11823
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
11824
|
+
style = _ref.style,
|
|
11825
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
11905
11826
|
|
|
11906
|
-
|
|
11907
|
-
|
|
11827
|
+
return _DisplayObject.call(this, _extends({
|
|
11828
|
+
type: Shape.POLYGON,
|
|
11829
|
+
style: _extends({
|
|
11830
|
+
points: '',
|
|
11831
|
+
miterLimit: ''
|
|
11832
|
+
}, style)
|
|
11833
|
+
}, rest)) || this;
|
|
11908
11834
|
}
|
|
11909
|
-
/**
|
|
11910
|
-
* create an animation with WAAPI
|
|
11911
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/animate
|
|
11912
|
-
*/
|
|
11913
|
-
;
|
|
11914
11835
|
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
var timeline = (_this$ownerDocument = this.ownerDocument) === null || _this$ownerDocument === void 0 ? void 0 : _this$ownerDocument.timeline; // account for clip path, use target's timeline
|
|
11836
|
+
return Polygon;
|
|
11837
|
+
}(DisplayObject);
|
|
11919
11838
|
|
|
11920
|
-
|
|
11921
|
-
|
|
11839
|
+
var _excluded$8 = ["style"];
|
|
11840
|
+
var Polyline = /*#__PURE__*/function (_DisplayObject) {
|
|
11841
|
+
_inheritsLoose(Polyline, _DisplayObject);
|
|
11922
11842
|
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11843
|
+
function Polyline(_temp) {
|
|
11844
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
11845
|
+
style = _ref.style,
|
|
11846
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
11926
11847
|
|
|
11848
|
+
return _DisplayObject.call(this, _extends({
|
|
11849
|
+
type: Shape.POLYLINE,
|
|
11850
|
+
style: _extends({
|
|
11851
|
+
points: '',
|
|
11852
|
+
miterLimit: ''
|
|
11853
|
+
}, style)
|
|
11854
|
+
}, rest)) || this;
|
|
11855
|
+
}
|
|
11927
11856
|
|
|
11928
|
-
|
|
11857
|
+
var _proto = Polyline.prototype;
|
|
11929
11858
|
|
|
11930
|
-
|
|
11931
|
-
|
|
11932
|
-
|
|
11859
|
+
_proto.getTotalLength = function getTotalLength() {
|
|
11860
|
+
return this.parsedStyle.points.totalLength;
|
|
11861
|
+
};
|
|
11933
11862
|
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11863
|
+
_proto.getPoint = function getPoint(ratio) {
|
|
11864
|
+
var _this$parsedStyle = this.parsedStyle,
|
|
11865
|
+
defX = _this$parsedStyle.defX,
|
|
11866
|
+
defY = _this$parsedStyle.defY,
|
|
11867
|
+
_this$parsedStyle$poi = _this$parsedStyle.points,
|
|
11868
|
+
points = _this$parsedStyle$poi.points,
|
|
11869
|
+
segments = _this$parsedStyle$poi.segments;
|
|
11870
|
+
var subt = 0;
|
|
11871
|
+
var index = 0;
|
|
11872
|
+
segments.forEach(function (v, i) {
|
|
11873
|
+
if (ratio >= v[0] && ratio <= v[1]) {
|
|
11874
|
+
subt = (ratio - v[0]) / (v[1] - v[0]);
|
|
11875
|
+
index = i;
|
|
11876
|
+
}
|
|
11877
|
+
});
|
|
11937
11878
|
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
* @deprecated
|
|
11942
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility
|
|
11943
|
-
*/
|
|
11944
|
-
;
|
|
11879
|
+
var _LineUtil$pointAt = Line$1.pointAt(points[index][0], points[index][1], points[index + 1][0], points[index + 1][1], subt),
|
|
11880
|
+
x = _LineUtil$pointAt.x,
|
|
11881
|
+
y = _LineUtil$pointAt.y;
|
|
11945
11882
|
|
|
11946
|
-
|
|
11947
|
-
this.style.visibility = 'visible';
|
|
11948
|
-
}
|
|
11949
|
-
/**
|
|
11950
|
-
* @deprecated
|
|
11951
|
-
* hide group, which will also change visibility of its children in sceneGraphNode
|
|
11952
|
-
*/
|
|
11953
|
-
;
|
|
11883
|
+
var transformed = vec3.transformMat4(vec3.create(), vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
|
|
11954
11884
|
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
}
|
|
11958
|
-
/**
|
|
11959
|
-
* shortcut for Used value of `visibility`
|
|
11960
|
-
*/
|
|
11961
|
-
;
|
|
11885
|
+
return new Point(transformed[0], transformed[1]);
|
|
11886
|
+
};
|
|
11962
11887
|
|
|
11963
|
-
_proto.
|
|
11964
|
-
var
|
|
11888
|
+
_proto.getStartTangent = function getStartTangent() {
|
|
11889
|
+
var points = this.parsedStyle.points.points;
|
|
11890
|
+
var result = [];
|
|
11891
|
+
result.push([points[1][0], points[1][1]]);
|
|
11892
|
+
result.push([points[0][0], points[0][1]]);
|
|
11893
|
+
return result;
|
|
11894
|
+
};
|
|
11965
11895
|
|
|
11966
|
-
|
|
11896
|
+
_proto.getEndTangent = function getEndTangent() {
|
|
11897
|
+
var points = this.parsedStyle.points.points;
|
|
11898
|
+
var l = points.length - 1;
|
|
11899
|
+
var result = [];
|
|
11900
|
+
result.push([points[l - 1][0], points[l - 1][1]]);
|
|
11901
|
+
result.push([points[l][0], points[l][1]]);
|
|
11902
|
+
return result;
|
|
11967
11903
|
};
|
|
11968
11904
|
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
return ((_this$parsedStyle2 = this.parsedStyle) === null || _this$parsedStyle2 === void 0 ? void 0 : (_this$parsedStyle2$po = _this$parsedStyle2.pointerEvents) === null || _this$parsedStyle2$po === void 0 ? void 0 : _this$parsedStyle2$po.value) !== 'none';
|
|
11973
|
-
};
|
|
11905
|
+
return Polyline;
|
|
11906
|
+
}(DisplayObject);
|
|
11974
11907
|
|
|
11975
|
-
|
|
11976
|
-
|
|
11977
|
-
|
|
11978
|
-
/**
|
|
11979
|
-
* bring to front in current group
|
|
11980
|
-
*/
|
|
11981
|
-
;
|
|
11908
|
+
var _excluded$9 = ["style"];
|
|
11909
|
+
var Rect = /*#__PURE__*/function (_DisplayObject) {
|
|
11910
|
+
_inheritsLoose(Rect, _DisplayObject);
|
|
11982
11911
|
|
|
11983
|
-
|
|
11984
|
-
|
|
11985
|
-
|
|
11986
|
-
|
|
11987
|
-
})) + 1;
|
|
11988
|
-
}
|
|
11912
|
+
function Rect(_temp) {
|
|
11913
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
11914
|
+
style = _ref.style,
|
|
11915
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
11989
11916
|
|
|
11990
|
-
return this
|
|
11917
|
+
return _DisplayObject.call(this, _extends({
|
|
11918
|
+
type: Shape.RECT,
|
|
11919
|
+
style: _extends({
|
|
11920
|
+
x: '',
|
|
11921
|
+
y: '',
|
|
11922
|
+
width: '',
|
|
11923
|
+
height: '',
|
|
11924
|
+
radius: ''
|
|
11925
|
+
}, style)
|
|
11926
|
+
}, rest)) || this;
|
|
11991
11927
|
}
|
|
11992
|
-
/**
|
|
11993
|
-
* send to back in current group
|
|
11994
|
-
*/
|
|
11995
|
-
;
|
|
11996
|
-
|
|
11997
|
-
_proto.toBack = function toBack() {
|
|
11998
|
-
if (this.parentNode) {
|
|
11999
|
-
this.style.zIndex = Math.min.apply(Math, this.parentNode.children.map(function (child) {
|
|
12000
|
-
return Number(child.style.zIndex);
|
|
12001
|
-
})) - 1;
|
|
12002
|
-
}
|
|
12003
|
-
|
|
12004
|
-
return this;
|
|
12005
|
-
} // #endregion visible
|
|
12006
|
-
// #region deprecated
|
|
12007
|
-
|
|
12008
|
-
/**
|
|
12009
|
-
* @deprecated
|
|
12010
|
-
* compatible with G 3.0
|
|
12011
|
-
* @deprecated
|
|
12012
|
-
*/
|
|
12013
|
-
;
|
|
12014
11928
|
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
}
|
|
12018
|
-
/**
|
|
12019
|
-
* @deprecated
|
|
12020
|
-
* compatible with G 3.0
|
|
12021
|
-
* @deprecated
|
|
12022
|
-
*/
|
|
12023
|
-
;
|
|
11929
|
+
return Rect;
|
|
11930
|
+
}(DisplayObject);
|
|
12024
11931
|
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
* @deprecated
|
|
12030
|
-
* compatible with G 3.0
|
|
12031
|
-
* @deprecated
|
|
12032
|
-
*/
|
|
12033
|
-
;
|
|
11932
|
+
var _excluded$a = ["style"];
|
|
11933
|
+
/**
|
|
11934
|
+
* <text> @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextElement
|
|
11935
|
+
*/
|
|
12034
11936
|
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
}
|
|
12038
|
-
/**
|
|
12039
|
-
* @deprecated
|
|
12040
|
-
* compatible with G 3.0
|
|
12041
|
-
* @deprecated
|
|
12042
|
-
*/
|
|
12043
|
-
;
|
|
11937
|
+
var Text = /*#__PURE__*/function (_DisplayObject) {
|
|
11938
|
+
_inheritsLoose(Text, _DisplayObject);
|
|
12044
11939
|
|
|
12045
|
-
_proto.getFirst = function getFirst() {
|
|
12046
|
-
return this.firstElementChild;
|
|
12047
|
-
}
|
|
12048
11940
|
/**
|
|
12049
|
-
* @
|
|
12050
|
-
* compatible with G 3.0
|
|
12051
|
-
* @deprecated
|
|
12052
|
-
* get last child group/shape
|
|
11941
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement#constants
|
|
12053
11942
|
*/
|
|
12054
|
-
;
|
|
11943
|
+
// LENGTHADJUST_SPACING: number = 1;
|
|
11944
|
+
// LENGTHADJUST_SPACINGANDGLYPHS: number = 2;
|
|
11945
|
+
// LENGTHADJUST_UNKNOWN: number = 0;
|
|
11946
|
+
function Text(_temp) {
|
|
11947
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
11948
|
+
style = _ref.style,
|
|
11949
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
12055
11950
|
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12064
|
-
|
|
12065
|
-
|
|
11951
|
+
return _DisplayObject.call(this, _extends({
|
|
11952
|
+
type: Shape.TEXT,
|
|
11953
|
+
style: _extends({
|
|
11954
|
+
x: '',
|
|
11955
|
+
y: '',
|
|
11956
|
+
text: '',
|
|
11957
|
+
fontSize: '',
|
|
11958
|
+
fontFamily: '',
|
|
11959
|
+
fontStyle: '',
|
|
11960
|
+
fontWeight: '',
|
|
11961
|
+
fontVariant: '',
|
|
11962
|
+
textAlign: '',
|
|
11963
|
+
textBaseline: '',
|
|
11964
|
+
textTransform: '',
|
|
11965
|
+
fill: 'black',
|
|
11966
|
+
letterSpacing: '',
|
|
11967
|
+
lineHeight: '',
|
|
11968
|
+
miterLimit: '',
|
|
11969
|
+
whiteSpace: 'pre',
|
|
11970
|
+
wordWrap: false,
|
|
11971
|
+
wordWrapWidth: 0,
|
|
11972
|
+
leading: 0,
|
|
11973
|
+
dx: '',
|
|
11974
|
+
dy: ''
|
|
11975
|
+
}, style)
|
|
11976
|
+
}, rest)) || this;
|
|
11977
|
+
} // lengthAdjust: SVGAnimatedEnumeration;
|
|
11978
|
+
// textLength: SVGAnimatedLength;
|
|
11979
|
+
// getCharNumAtPosition(point?: DOMPointInit): number {
|
|
11980
|
+
// throw new Error('Method not implemented.');
|
|
11981
|
+
// }
|
|
12066
11982
|
|
|
12067
|
-
_proto.getChildByIndex = function getChildByIndex(index) {
|
|
12068
|
-
return this.children[index] || null;
|
|
12069
|
-
}
|
|
12070
11983
|
/**
|
|
12071
|
-
*
|
|
12072
|
-
* @deprecated
|
|
11984
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement
|
|
12073
11985
|
*/
|
|
12074
|
-
;
|
|
12075
11986
|
|
|
12076
|
-
_proto.add = function add(child, index) {
|
|
12077
|
-
return this.appendChild(child, index);
|
|
12078
|
-
}
|
|
12079
|
-
/**
|
|
12080
|
-
* @alias style.clipPath
|
|
12081
|
-
* @deprecated
|
|
12082
|
-
*/
|
|
12083
|
-
;
|
|
12084
11987
|
|
|
12085
|
-
_proto
|
|
12086
|
-
this.style.clipPath = clipPath;
|
|
12087
|
-
}
|
|
12088
|
-
/**
|
|
12089
|
-
* @alias style.clipPath
|
|
12090
|
-
* @deprecated
|
|
12091
|
-
*/
|
|
12092
|
-
;
|
|
11988
|
+
var _proto = Text.prototype;
|
|
12093
11989
|
|
|
12094
|
-
_proto.
|
|
12095
|
-
|
|
12096
|
-
}
|
|
12097
|
-
/**
|
|
12098
|
-
* compatible with G 3.0
|
|
12099
|
-
* @deprecated
|
|
12100
|
-
*/
|
|
12101
|
-
;
|
|
11990
|
+
_proto.getComputedTextLength = function getComputedTextLength() {
|
|
11991
|
+
var _this$parsedStyle$met;
|
|
12102
11992
|
|
|
12103
|
-
|
|
12104
|
-
|
|
12105
|
-
|
|
12106
|
-
|
|
12107
|
-
|
|
12108
|
-
|
|
12109
|
-
|
|
11993
|
+
return ((_this$parsedStyle$met = this.parsedStyle.metrics) === null || _this$parsedStyle$met === void 0 ? void 0 : _this$parsedStyle$met.maxLineWidth) || 0;
|
|
11994
|
+
} // getEndPositionOfChar(charnum: number): DOMPoint {
|
|
11995
|
+
// throw new Error('Method not implemented.');
|
|
11996
|
+
// }
|
|
11997
|
+
// getExtentOfChar(charnum: number): DOMRect {
|
|
11998
|
+
// throw new Error('Method not implemented.');
|
|
11999
|
+
// }
|
|
12000
|
+
// getNumberOfChars(): number {
|
|
12001
|
+
// throw new Error('Method not implemented.');
|
|
12002
|
+
// }
|
|
12003
|
+
// getRotationOfChar(charnum: number): number {
|
|
12004
|
+
// throw new Error('Method not implemented.');
|
|
12005
|
+
// }
|
|
12006
|
+
// getStartPositionOfChar(charnum: number): DOMPoint {
|
|
12007
|
+
// throw new Error('Method not implemented.');
|
|
12008
|
+
// }
|
|
12009
|
+
// getSubStringLength(charnum: number, nchars: number): number {
|
|
12010
|
+
// throw new Error('Method not implemented.');
|
|
12011
|
+
// }
|
|
12012
|
+
// selectSubString(charnum: number, nchars: number): void {
|
|
12013
|
+
// throw new Error('Method not implemented.');
|
|
12014
|
+
// }
|
|
12110
12015
|
;
|
|
12111
12016
|
|
|
12112
|
-
_proto.
|
|
12113
|
-
|
|
12114
|
-
}
|
|
12115
|
-
/**
|
|
12116
|
-
* compatible with G 3.0
|
|
12117
|
-
* @alias object.config
|
|
12118
|
-
* @deprecated
|
|
12119
|
-
*/
|
|
12120
|
-
;
|
|
12017
|
+
_proto.getLineBoundingRects = function getLineBoundingRects() {
|
|
12018
|
+
var _this$parsedStyle$met2;
|
|
12121
12019
|
|
|
12122
|
-
|
|
12123
|
-
return this.config;
|
|
12020
|
+
return ((_this$parsedStyle$met2 = this.parsedStyle.metrics) === null || _this$parsedStyle$met2 === void 0 ? void 0 : _this$parsedStyle$met2.lineMetrics) || [];
|
|
12124
12021
|
};
|
|
12125
12022
|
|
|
12126
|
-
|
|
12127
|
-
|
|
12128
|
-
|
|
12129
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
12130
|
-
args[_key] = arguments[_key];
|
|
12131
|
-
}
|
|
12023
|
+
return Text;
|
|
12024
|
+
}(DisplayObject);
|
|
12132
12025
|
|
|
12133
|
-
|
|
12134
|
-
|
|
12026
|
+
var _excluded$b = ["style"];
|
|
12027
|
+
/**
|
|
12028
|
+
* HTML container
|
|
12029
|
+
* @see https://github.com/pmndrs/drei#html
|
|
12030
|
+
*/
|
|
12135
12031
|
|
|
12136
|
-
|
|
12137
|
-
|
|
12138
|
-
}
|
|
12032
|
+
var HTML = /*#__PURE__*/function (_DisplayObject) {
|
|
12033
|
+
_inheritsLoose(HTML, _DisplayObject);
|
|
12139
12034
|
|
|
12140
|
-
|
|
12141
|
-
|
|
12142
|
-
_this3.setAttribute(key, name[key]);
|
|
12143
|
-
});
|
|
12144
|
-
return this;
|
|
12145
|
-
}
|
|
12035
|
+
function HTML(_temp) {
|
|
12036
|
+
var _this;
|
|
12146
12037
|
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
}
|
|
12038
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
12039
|
+
style = _ref.style,
|
|
12040
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
12151
12041
|
|
|
12152
|
-
|
|
12042
|
+
_this = _DisplayObject.call(this, _extends({
|
|
12043
|
+
type: Shape.HTML,
|
|
12044
|
+
style: _extends({
|
|
12045
|
+
x: '',
|
|
12046
|
+
y: '',
|
|
12047
|
+
width: 'auto',
|
|
12048
|
+
height: 'auto',
|
|
12049
|
+
innerHTML: ''
|
|
12050
|
+
}, style)
|
|
12051
|
+
}, rest)) || this;
|
|
12052
|
+
_this.cullable.enable = false;
|
|
12053
|
+
return _this;
|
|
12153
12054
|
}
|
|
12154
|
-
/**
|
|
12155
|
-
*
|
|
12156
|
-
*
|
|
12055
|
+
/**
|
|
12056
|
+
* return wrapper HTMLElement
|
|
12057
|
+
* * <div> in g-webgl/canvas
|
|
12058
|
+
* * <foreignObject> in g-svg
|
|
12157
12059
|
*/
|
|
12158
|
-
;
|
|
12159
12060
|
|
|
12160
|
-
_proto.moveTo = function moveTo(position, y, z) {
|
|
12161
|
-
if (y === void 0) {
|
|
12162
|
-
y = 0;
|
|
12163
|
-
}
|
|
12164
12061
|
|
|
12165
|
-
|
|
12166
|
-
z = 0;
|
|
12167
|
-
}
|
|
12062
|
+
var _proto = HTML.prototype;
|
|
12168
12063
|
|
|
12169
|
-
|
|
12170
|
-
return this;
|
|
12064
|
+
_proto.getDomElement = function getDomElement() {
|
|
12065
|
+
return this.parsedStyle.$el;
|
|
12171
12066
|
}
|
|
12172
12067
|
/**
|
|
12173
|
-
*
|
|
12174
|
-
* @
|
|
12068
|
+
* override with $el.getBoundingClientRect
|
|
12069
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getBoundingClientRect
|
|
12175
12070
|
*/
|
|
12176
12071
|
;
|
|
12177
12072
|
|
|
12178
|
-
_proto.
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
}
|
|
12073
|
+
_proto.getBoundingClientRect = function getBoundingClientRect() {
|
|
12074
|
+
return this.parsedStyle.$el.getBoundingClientRect();
|
|
12075
|
+
};
|
|
12182
12076
|
|
|
12183
|
-
|
|
12184
|
-
|
|
12077
|
+
_proto.getClientRects = function getClientRects() {
|
|
12078
|
+
return [this.getBoundingClientRect()];
|
|
12079
|
+
};
|
|
12080
|
+
|
|
12081
|
+
_proto.getBounds = function getBounds() {
|
|
12082
|
+
var _this$ownerDocument, _this$ownerDocument$d;
|
|
12083
|
+
|
|
12084
|
+
var clientRect = this.getBoundingClientRect(); // calc context's offset
|
|
12085
|
+
// @ts-ignore
|
|
12086
|
+
|
|
12087
|
+
var canvasRect = (_this$ownerDocument = this.ownerDocument) === null || _this$ownerDocument === void 0 ? void 0 : (_this$ownerDocument$d = _this$ownerDocument.defaultView) === null || _this$ownerDocument$d === void 0 ? void 0 : _this$ownerDocument$d.getContextService().getBoundingClientRect();
|
|
12088
|
+
|
|
12089
|
+
if (canvasRect) {
|
|
12090
|
+
var minX = clientRect.left - canvasRect.left;
|
|
12091
|
+
var minY = clientRect.top - canvasRect.top;
|
|
12092
|
+
var aabb = new AABB();
|
|
12093
|
+
aabb.setMinMax(vec3.fromValues(minX, minY, 0), vec3.fromValues(minX + clientRect.width, minY + clientRect.height, 0));
|
|
12094
|
+
return aabb;
|
|
12185
12095
|
}
|
|
12186
12096
|
|
|
12187
|
-
|
|
12188
|
-
|
|
12189
|
-
}
|
|
12190
|
-
/**
|
|
12191
|
-
* @alias style.zIndex
|
|
12192
|
-
* @deprecated
|
|
12193
|
-
*/
|
|
12194
|
-
;
|
|
12097
|
+
return null;
|
|
12098
|
+
};
|
|
12195
12099
|
|
|
12196
|
-
_proto.
|
|
12197
|
-
this.
|
|
12198
|
-
|
|
12199
|
-
|
|
12200
|
-
/**
|
|
12201
|
-
* return 3x3 matrix in world space
|
|
12202
|
-
* @deprecated
|
|
12203
|
-
*/
|
|
12204
|
-
;
|
|
12100
|
+
_proto.getLocalBounds = function getLocalBounds() {
|
|
12101
|
+
if (this.parentNode) {
|
|
12102
|
+
var parentInvert = mat4.invert(mat4.create(), this.parentNode.getWorldTransform());
|
|
12103
|
+
var bounds = this.getBounds();
|
|
12205
12104
|
|
|
12206
|
-
|
|
12207
|
-
|
|
12105
|
+
if (!AABB.isEmpty(bounds)) {
|
|
12106
|
+
var localBounds = new AABB();
|
|
12107
|
+
localBounds.setFromTransformedAABB(bounds, parentInvert);
|
|
12108
|
+
return localBounds;
|
|
12109
|
+
}
|
|
12110
|
+
}
|
|
12208
12111
|
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
ty = _mat4$getTranslation[1];
|
|
12112
|
+
return this.getBounds();
|
|
12113
|
+
};
|
|
12212
12114
|
|
|
12213
|
-
|
|
12214
|
-
|
|
12215
|
-
sy = _mat4$getScaling[1];
|
|
12115
|
+
return HTML;
|
|
12116
|
+
}(DisplayObject);
|
|
12216
12117
|
|
|
12217
|
-
|
|
12118
|
+
/**
|
|
12119
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationPlaybackEvent
|
|
12120
|
+
*/
|
|
12218
12121
|
|
|
12219
|
-
|
|
12220
|
-
|
|
12221
|
-
euy = _getEuler3[1],
|
|
12222
|
-
euz = _getEuler3[2]; // gimbal lock at 90 degrees
|
|
12122
|
+
var AnimationEvent = /*#__PURE__*/function (_FederatedEvent) {
|
|
12123
|
+
_inheritsLoose(AnimationEvent, _FederatedEvent);
|
|
12223
12124
|
|
|
12125
|
+
function AnimationEvent(manager, target, currentTime, timelineTime) {
|
|
12126
|
+
var _this;
|
|
12224
12127
|
|
|
12225
|
-
|
|
12226
|
-
|
|
12227
|
-
|
|
12228
|
-
|
|
12229
|
-
|
|
12230
|
-
*/
|
|
12231
|
-
;
|
|
12128
|
+
_this = _FederatedEvent.call(this, manager) || this;
|
|
12129
|
+
_this.currentTime = void 0;
|
|
12130
|
+
_this.timelineTime = void 0;
|
|
12131
|
+
_this.currentTime = currentTime;
|
|
12132
|
+
_this.timelineTime = timelineTime; // @ts-ignore
|
|
12232
12133
|
|
|
12233
|
-
|
|
12234
|
-
|
|
12134
|
+
_this.target = target;
|
|
12135
|
+
_this.type = 'finish';
|
|
12136
|
+
_this.bubbles = false; // @ts-ignore
|
|
12137
|
+
|
|
12138
|
+
_this.currentTarget = target;
|
|
12139
|
+
_this.defaultPrevented = false;
|
|
12140
|
+
_this.eventPhase = _this.AT_TARGET;
|
|
12141
|
+
_this.timeStamp = Date.now();
|
|
12142
|
+
_this.currentTime = currentTime;
|
|
12143
|
+
_this.timelineTime = timelineTime;
|
|
12144
|
+
return _this;
|
|
12235
12145
|
}
|
|
12236
|
-
/**
|
|
12237
|
-
* set 3x3 matrix in world space
|
|
12238
|
-
* @deprecated
|
|
12239
|
-
*/
|
|
12240
|
-
;
|
|
12241
12146
|
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
tx = _decompose[0],
|
|
12245
|
-
ty = _decompose[1],
|
|
12246
|
-
scalingX = _decompose[2],
|
|
12247
|
-
scalingY = _decompose[3],
|
|
12248
|
-
angle = _decompose[4];
|
|
12147
|
+
return AnimationEvent;
|
|
12148
|
+
}(FederatedEvent);
|
|
12249
12149
|
|
|
12250
|
-
|
|
12150
|
+
var sequenceNumber = 0;
|
|
12151
|
+
/**
|
|
12152
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/Animation
|
|
12153
|
+
*/
|
|
12154
|
+
|
|
12155
|
+
var Animation = /*#__PURE__*/function () {
|
|
12156
|
+
function Animation(effect, timeline) {
|
|
12157
|
+
this.effect = void 0;
|
|
12158
|
+
this.timeline = void 0;
|
|
12159
|
+
this.id = void 0;
|
|
12160
|
+
this.currentTimePending = false;
|
|
12161
|
+
this._idle = true;
|
|
12162
|
+
this._paused = false;
|
|
12163
|
+
this._finishedFlag = true;
|
|
12164
|
+
this.oldPlayState = void 0;
|
|
12165
|
+
this._holdTime = void 0;
|
|
12166
|
+
this.readyPromise = void 0;
|
|
12167
|
+
this.finishedPromise = void 0;
|
|
12168
|
+
this.resolveReadyPromise = void 0;
|
|
12169
|
+
this.rejectReadyPromise = void 0;
|
|
12170
|
+
this.resolveFinishedPromise = void 0;
|
|
12171
|
+
this.rejectFinishedPromise = void 0;
|
|
12172
|
+
this.onfinish = void 0;
|
|
12173
|
+
this.oncancel = void 0;
|
|
12174
|
+
this.onframe = void 0;
|
|
12175
|
+
this._currentTime = 0;
|
|
12176
|
+
this._startTime = void 0;
|
|
12177
|
+
this._playbackRate = 1;
|
|
12178
|
+
this._inEffect = void 0;
|
|
12179
|
+
this._inTimeline = true;
|
|
12180
|
+
this.onremove = void 0;
|
|
12181
|
+
this.effect = effect;
|
|
12182
|
+
effect.animation = this;
|
|
12183
|
+
this.timeline = timeline;
|
|
12184
|
+
this.id = "" + sequenceNumber++;
|
|
12185
|
+
this._inEffect = !!this.effect.update(0);
|
|
12186
|
+
this._holdTime = 0;
|
|
12187
|
+
this._paused = false;
|
|
12188
|
+
this.oldPlayState = 'idle';
|
|
12189
|
+
this.updatePromises();
|
|
12251
12190
|
}
|
|
12252
12191
|
/**
|
|
12253
|
-
*
|
|
12254
|
-
*
|
|
12192
|
+
* state machine,
|
|
12193
|
+
* resolve/reject ready/finished Promise according to current state
|
|
12255
12194
|
*/
|
|
12256
|
-
;
|
|
12257
12195
|
|
|
12258
|
-
_proto.setLocalMatrix = function setLocalMatrix(mat) {
|
|
12259
|
-
var _decompose2 = decompose(mat),
|
|
12260
|
-
tx = _decompose2[0],
|
|
12261
|
-
ty = _decompose2[1],
|
|
12262
|
-
scalingX = _decompose2[2],
|
|
12263
|
-
scalingY = _decompose2[3],
|
|
12264
|
-
angle = _decompose2[4];
|
|
12265
12196
|
|
|
12266
|
-
|
|
12267
|
-
};
|
|
12197
|
+
var _proto = Animation.prototype;
|
|
12268
12198
|
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12199
|
+
_proto.updatePromises = function updatePromises() {
|
|
12200
|
+
var oldPlayState = this.oldPlayState;
|
|
12201
|
+
var newPlayState = this.pending ? 'pending' : this.playState;
|
|
12202
|
+
|
|
12203
|
+
if (this.readyPromise && newPlayState !== oldPlayState) {
|
|
12204
|
+
if (newPlayState === 'idle') {
|
|
12205
|
+
this.rejectReadyPromise();
|
|
12206
|
+
this.readyPromise = undefined;
|
|
12207
|
+
} else if (oldPlayState === 'pending') {
|
|
12208
|
+
this.resolveReadyPromise();
|
|
12209
|
+
} else if (newPlayState === 'pending') {
|
|
12210
|
+
this.readyPromise = undefined;
|
|
12211
|
+
}
|
|
12276
12212
|
}
|
|
12277
|
-
}]);
|
|
12278
12213
|
|
|
12279
|
-
|
|
12280
|
-
|
|
12214
|
+
if (this.finishedPromise && newPlayState !== oldPlayState) {
|
|
12215
|
+
if (newPlayState === 'idle') {
|
|
12216
|
+
this.rejectFinishedPromise();
|
|
12217
|
+
this.finishedPromise = undefined;
|
|
12218
|
+
} else if (newPlayState === 'finished') {
|
|
12219
|
+
this.resolveFinishedPromise();
|
|
12220
|
+
} else if (oldPlayState === 'finished') {
|
|
12221
|
+
this.finishedPromise = undefined;
|
|
12222
|
+
}
|
|
12223
|
+
}
|
|
12281
12224
|
|
|
12282
|
-
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
* @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
|
|
12286
|
-
*/
|
|
12225
|
+
this.oldPlayState = newPlayState;
|
|
12226
|
+
return this.readyPromise || this.finishedPromise;
|
|
12227
|
+
};
|
|
12287
12228
|
|
|
12288
|
-
|
|
12289
|
-
|
|
12229
|
+
_proto.play = function play() {
|
|
12230
|
+
this.updatePromises();
|
|
12231
|
+
this._paused = false;
|
|
12232
|
+
|
|
12233
|
+
if (this._isFinished || this._idle) {
|
|
12234
|
+
this.rewind();
|
|
12235
|
+
this._startTime = null;
|
|
12236
|
+
}
|
|
12237
|
+
|
|
12238
|
+
this._finishedFlag = false;
|
|
12239
|
+
this._idle = false;
|
|
12240
|
+
this.ensureAlive();
|
|
12241
|
+
this.timeline.applyDirtiedAnimation(this);
|
|
12242
|
+
|
|
12243
|
+
if (this.timeline.animations.indexOf(this) === -1) {
|
|
12244
|
+
this.timeline.animations.push(this);
|
|
12245
|
+
}
|
|
12290
12246
|
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
// }
|
|
12294
|
-
// private shadowNodes: DisplayObject[] = [];
|
|
12295
|
-
function CustomElement(_temp) {
|
|
12296
|
-
var _this;
|
|
12247
|
+
this.updatePromises();
|
|
12248
|
+
};
|
|
12297
12249
|
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
12250
|
+
_proto.pause = function pause() {
|
|
12251
|
+
this.updatePromises();
|
|
12301
12252
|
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
y: ''
|
|
12306
|
-
}, style)
|
|
12307
|
-
}, rest)) || this;
|
|
12308
|
-
_this.isCustomElement = true;
|
|
12309
|
-
return _this;
|
|
12310
|
-
}
|
|
12253
|
+
if (this.currentTime) {
|
|
12254
|
+
this._holdTime = this.currentTime;
|
|
12255
|
+
}
|
|
12311
12256
|
|
|
12312
|
-
|
|
12313
|
-
|
|
12257
|
+
if (!this._isFinished && !this._paused && !this._idle) {
|
|
12258
|
+
this.currentTimePending = true;
|
|
12259
|
+
} else if (this._idle) {
|
|
12260
|
+
this.rewind();
|
|
12261
|
+
this._idle = false;
|
|
12262
|
+
}
|
|
12314
12263
|
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12264
|
+
this._startTime = null;
|
|
12265
|
+
this._paused = true;
|
|
12266
|
+
this.updatePromises();
|
|
12267
|
+
};
|
|
12318
12268
|
|
|
12319
|
-
function
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12269
|
+
_proto.finish = function finish() {
|
|
12270
|
+
this.updatePromises();
|
|
12271
|
+
if (this._idle) return;
|
|
12272
|
+
this.currentTime = this._playbackRate > 0 ? this.totalDuration : 0;
|
|
12273
|
+
this._startTime = this.totalDuration - this.currentTime;
|
|
12274
|
+
this.currentTimePending = false;
|
|
12275
|
+
this.timeline.applyDirtiedAnimation(this);
|
|
12276
|
+
this.updatePromises();
|
|
12277
|
+
};
|
|
12323
12278
|
|
|
12324
|
-
|
|
12325
|
-
|
|
12326
|
-
|
|
12327
|
-
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12279
|
+
_proto.cancel = function cancel() {
|
|
12280
|
+
this.updatePromises();
|
|
12281
|
+
if (!this._inEffect) return;
|
|
12282
|
+
this._inEffect = false;
|
|
12283
|
+
this._idle = true;
|
|
12284
|
+
this._paused = false;
|
|
12285
|
+
this._finishedFlag = true;
|
|
12286
|
+
this._currentTime = 0;
|
|
12287
|
+
this._startTime = null;
|
|
12288
|
+
this.effect.update(null); // effects are invalid after cancellation as the animation state
|
|
12289
|
+
// needs to un-apply.
|
|
12333
12290
|
|
|
12334
|
-
|
|
12335
|
-
|
|
12291
|
+
this.timeline.applyDirtiedAnimation(this);
|
|
12292
|
+
this.updatePromises();
|
|
12293
|
+
};
|
|
12336
12294
|
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12295
|
+
_proto.reverse = function reverse() {
|
|
12296
|
+
this.updatePromises();
|
|
12297
|
+
var oldCurrentTime = this.currentTime;
|
|
12298
|
+
this.playbackRate *= -1;
|
|
12299
|
+
this.play();
|
|
12340
12300
|
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
12301
|
+
if (oldCurrentTime !== null) {
|
|
12302
|
+
this.currentTime = oldCurrentTime;
|
|
12303
|
+
}
|
|
12345
12304
|
|
|
12346
|
-
|
|
12347
|
-
type: Shape.ELLIPSE,
|
|
12348
|
-
style: _extends({
|
|
12349
|
-
cx: '',
|
|
12350
|
-
cy: '',
|
|
12351
|
-
rx: '',
|
|
12352
|
-
ry: ''
|
|
12353
|
-
}, style)
|
|
12354
|
-
}, rest)) || this;
|
|
12305
|
+
this.updatePromises();
|
|
12355
12306
|
}
|
|
12307
|
+
/**
|
|
12308
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/updatePlaybackRate
|
|
12309
|
+
*/
|
|
12310
|
+
;
|
|
12356
12311
|
|
|
12357
|
-
|
|
12358
|
-
|
|
12312
|
+
_proto.updatePlaybackRate = function updatePlaybackRate(playbackRate) {
|
|
12313
|
+
this.playbackRate = playbackRate;
|
|
12314
|
+
};
|
|
12359
12315
|
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
* its attributes are inherited by its children.
|
|
12363
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/g
|
|
12364
|
-
*
|
|
12365
|
-
* @example
|
|
12366
|
-
* <g fill="white" stroke="green" stroke-width="5">
|
|
12367
|
-
<circle cx="40" cy="40" r="25" />
|
|
12368
|
-
<circle cx="60" cy="60" r="25" />
|
|
12369
|
-
</g>
|
|
12370
|
-
*/
|
|
12316
|
+
_proto.targetAnimations = function targetAnimations() {
|
|
12317
|
+
var _this$effect;
|
|
12371
12318
|
|
|
12372
|
-
var
|
|
12373
|
-
|
|
12319
|
+
var target = (_this$effect = this.effect) === null || _this$effect === void 0 ? void 0 : _this$effect.target;
|
|
12320
|
+
return target.getAnimations();
|
|
12321
|
+
};
|
|
12374
12322
|
|
|
12375
|
-
function
|
|
12376
|
-
var
|
|
12377
|
-
style = _ref.style,
|
|
12378
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
12323
|
+
_proto.markTarget = function markTarget() {
|
|
12324
|
+
var animations = this.targetAnimations();
|
|
12379
12325
|
|
|
12380
|
-
|
|
12381
|
-
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
y: '',
|
|
12385
|
-
width: '',
|
|
12386
|
-
height: ''
|
|
12387
|
-
}, style)
|
|
12388
|
-
}, rest)) || this;
|
|
12389
|
-
}
|
|
12326
|
+
if (animations.indexOf(this) === -1) {
|
|
12327
|
+
animations.push(this);
|
|
12328
|
+
}
|
|
12329
|
+
};
|
|
12390
12330
|
|
|
12391
|
-
|
|
12392
|
-
|
|
12331
|
+
_proto.unmarkTarget = function unmarkTarget() {
|
|
12332
|
+
var animations = this.targetAnimations();
|
|
12333
|
+
var index = animations.indexOf(this);
|
|
12393
12334
|
|
|
12394
|
-
|
|
12395
|
-
|
|
12396
|
-
|
|
12335
|
+
if (index !== -1) {
|
|
12336
|
+
animations.splice(index, 1);
|
|
12337
|
+
}
|
|
12338
|
+
};
|
|
12397
12339
|
|
|
12398
|
-
function
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
|
|
12340
|
+
_proto.tick = function tick(timelineTime, isAnimationFrame) {
|
|
12341
|
+
if (!this._idle && !this._paused) {
|
|
12342
|
+
if (this._startTime === null) {
|
|
12343
|
+
if (isAnimationFrame) {
|
|
12344
|
+
this.startTime = timelineTime - this._currentTime / this.playbackRate;
|
|
12345
|
+
}
|
|
12346
|
+
} else if (!this._isFinished) {
|
|
12347
|
+
this.tickCurrentTime((timelineTime - this._startTime) * this.playbackRate);
|
|
12348
|
+
}
|
|
12349
|
+
}
|
|
12402
12350
|
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
|
|
12407
|
-
|
|
12408
|
-
img: '',
|
|
12409
|
-
width: '',
|
|
12410
|
-
height: ''
|
|
12411
|
-
}, style)
|
|
12412
|
-
}, rest)) || this;
|
|
12413
|
-
}
|
|
12351
|
+
if (isAnimationFrame) {
|
|
12352
|
+
this.currentTimePending = false;
|
|
12353
|
+
this.fireEvents(timelineTime);
|
|
12354
|
+
}
|
|
12355
|
+
};
|
|
12414
12356
|
|
|
12415
|
-
|
|
12416
|
-
|
|
12357
|
+
_proto.rewind = function rewind() {
|
|
12358
|
+
if (this.playbackRate >= 0) {
|
|
12359
|
+
this.currentTime = 0;
|
|
12360
|
+
} else if (this.totalDuration < Infinity) {
|
|
12361
|
+
this.currentTime = this.totalDuration;
|
|
12362
|
+
} else {
|
|
12363
|
+
throw new Error('Unable to rewind negative playback rate animation with infinite duration');
|
|
12364
|
+
}
|
|
12365
|
+
};
|
|
12417
12366
|
|
|
12418
|
-
|
|
12419
|
-
|
|
12420
|
-
|
|
12367
|
+
_proto.persist = function persist() {
|
|
12368
|
+
throw new Error('Method not implemented.');
|
|
12369
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12370
|
+
;
|
|
12421
12371
|
|
|
12422
|
-
function
|
|
12423
|
-
|
|
12424
|
-
|
|
12425
|
-
|
|
12372
|
+
_proto.addEventListener = function addEventListener(type, listener, options) {
|
|
12373
|
+
throw new Error('Method not implemented.');
|
|
12374
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12375
|
+
;
|
|
12426
12376
|
|
|
12427
|
-
|
|
12428
|
-
|
|
12429
|
-
|
|
12430
|
-
|
|
12431
|
-
y1: 0,
|
|
12432
|
-
x2: 0,
|
|
12433
|
-
y2: 0,
|
|
12434
|
-
z1: 0,
|
|
12435
|
-
z2: 0,
|
|
12436
|
-
isBillboard: false
|
|
12437
|
-
}, style)
|
|
12438
|
-
}, rest)) || this;
|
|
12439
|
-
}
|
|
12377
|
+
_proto.removeEventListener = function removeEventListener(type, listener, options) {
|
|
12378
|
+
throw new Error('Method not implemented.');
|
|
12379
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12380
|
+
;
|
|
12440
12381
|
|
|
12441
|
-
|
|
12382
|
+
_proto.dispatchEvent = function dispatchEvent(event) {
|
|
12383
|
+
throw new Error('Method not implemented.');
|
|
12384
|
+
};
|
|
12442
12385
|
|
|
12443
|
-
|
|
12444
|
-
|
|
12445
|
-
|
|
12446
|
-
|
|
12447
|
-
|
|
12448
|
-
|
|
12449
|
-
|
|
12450
|
-
|
|
12451
|
-
|
|
12386
|
+
// replaceState: AnimationReplaceState;
|
|
12387
|
+
_proto.commitStyles = function commitStyles() {
|
|
12388
|
+
throw new Error('Method not implemented.');
|
|
12389
|
+
};
|
|
12390
|
+
|
|
12391
|
+
_proto.ensureAlive = function ensureAlive() {
|
|
12392
|
+
// If an animation is playing backwards and is not fill backwards/both
|
|
12393
|
+
// then it should go out of effect when it reaches the start of its
|
|
12394
|
+
// active interval (currentTime === 0).
|
|
12395
|
+
if (this.playbackRate < 0 && this.currentTime === 0) {
|
|
12396
|
+
var _this$effect2;
|
|
12452
12397
|
|
|
12453
|
-
|
|
12454
|
-
|
|
12455
|
-
|
|
12398
|
+
this._inEffect = !!((_this$effect2 = this.effect) === null || _this$effect2 === void 0 ? void 0 : _this$effect2.update(-1));
|
|
12399
|
+
} else {
|
|
12400
|
+
var _this$effect3;
|
|
12456
12401
|
|
|
12457
|
-
|
|
12402
|
+
this._inEffect = !!((_this$effect3 = this.effect) === null || _this$effect3 === void 0 ? void 0 : _this$effect3.update(this.currentTime));
|
|
12403
|
+
}
|
|
12458
12404
|
|
|
12459
|
-
|
|
12405
|
+
if (!this._inTimeline && (this._inEffect || !this._finishedFlag)) {
|
|
12406
|
+
this._inTimeline = true;
|
|
12407
|
+
this.timeline.animations.push(this);
|
|
12408
|
+
}
|
|
12460
12409
|
};
|
|
12461
12410
|
|
|
12462
|
-
_proto.
|
|
12463
|
-
|
|
12464
|
-
|
|
12465
|
-
|
|
12466
|
-
|
|
12467
|
-
|
|
12468
|
-
|
|
12469
|
-
|
|
12411
|
+
_proto.tickCurrentTime = function tickCurrentTime(newTime, ignoreLimit) {
|
|
12412
|
+
if (newTime !== this._currentTime) {
|
|
12413
|
+
this._currentTime = newTime;
|
|
12414
|
+
|
|
12415
|
+
if (this._isFinished && !ignoreLimit) {
|
|
12416
|
+
this._currentTime = this._playbackRate > 0 ? this.totalDuration : 0;
|
|
12417
|
+
}
|
|
12418
|
+
|
|
12419
|
+
this.ensureAlive();
|
|
12420
|
+
}
|
|
12470
12421
|
};
|
|
12471
12422
|
|
|
12472
|
-
|
|
12473
|
-
|
|
12423
|
+
_proto.fireEvents = function fireEvents(baseTime) {
|
|
12424
|
+
var _this = this;
|
|
12474
12425
|
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
|
|
12426
|
+
if (this._isFinished) {
|
|
12427
|
+
if (!this._finishedFlag) {
|
|
12428
|
+
if (this.onfinish) {
|
|
12429
|
+
var event = new AnimationEvent(null, this, this.currentTime, baseTime);
|
|
12430
|
+
setTimeout(function () {
|
|
12431
|
+
if (_this.onfinish) {
|
|
12432
|
+
_this.onfinish(event);
|
|
12433
|
+
}
|
|
12434
|
+
});
|
|
12435
|
+
}
|
|
12478
12436
|
|
|
12479
|
-
|
|
12480
|
-
|
|
12481
|
-
|
|
12482
|
-
|
|
12437
|
+
this._finishedFlag = true;
|
|
12438
|
+
}
|
|
12439
|
+
} else {
|
|
12440
|
+
if (this.onframe && this.playState === 'running') {
|
|
12441
|
+
var _event = new AnimationEvent(null, this, this.currentTime, baseTime);
|
|
12483
12442
|
|
|
12484
|
-
|
|
12485
|
-
|
|
12486
|
-
style: _extends({
|
|
12487
|
-
path: '',
|
|
12488
|
-
miterLimit: 4
|
|
12489
|
-
}, style)
|
|
12490
|
-
}, rest)) || this;
|
|
12491
|
-
}
|
|
12443
|
+
this.onframe(_event);
|
|
12444
|
+
}
|
|
12492
12445
|
|
|
12493
|
-
|
|
12446
|
+
this._finishedFlag = false;
|
|
12447
|
+
}
|
|
12448
|
+
};
|
|
12494
12449
|
|
|
12495
|
-
|
|
12496
|
-
|
|
12497
|
-
|
|
12498
|
-
|
|
12499
|
-
|
|
12500
|
-
|
|
12501
|
-
;
|
|
12450
|
+
_createClass(Animation, [{
|
|
12451
|
+
key: "pending",
|
|
12452
|
+
get:
|
|
12453
|
+
/**
|
|
12454
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/effect
|
|
12455
|
+
*/
|
|
12502
12456
|
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
|
|
12506
|
-
defY = _this$parsedStyle.defY,
|
|
12507
|
-
_this$parsedStyle$pat = _this$parsedStyle.path,
|
|
12508
|
-
totalLength = _this$parsedStyle$pat.totalLength,
|
|
12509
|
-
absolutePath = _this$parsedStyle$pat.absolutePath;
|
|
12457
|
+
/**
|
|
12458
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/timeline
|
|
12459
|
+
*/
|
|
12510
12460
|
|
|
12511
|
-
|
|
12512
|
-
|
|
12513
|
-
|
|
12461
|
+
/**
|
|
12462
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/id
|
|
12463
|
+
*/
|
|
12464
|
+
// animation: InternalAnimation | null;
|
|
12514
12465
|
|
|
12515
|
-
|
|
12466
|
+
/**
|
|
12467
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/pending
|
|
12468
|
+
*/
|
|
12469
|
+
function get() {
|
|
12470
|
+
return this._startTime === null && !this._paused && this.playbackRate !== 0 || this.currentTimePending;
|
|
12471
|
+
}
|
|
12472
|
+
}, {
|
|
12473
|
+
key: "playState",
|
|
12474
|
+
get: function get() {
|
|
12475
|
+
if (this._idle) return 'idle';
|
|
12476
|
+
if (this._isFinished) return 'finished';
|
|
12477
|
+
if (this._paused) return 'paused';
|
|
12478
|
+
return 'running';
|
|
12479
|
+
}
|
|
12480
|
+
/**
|
|
12481
|
+
* record previos state
|
|
12482
|
+
*/
|
|
12516
12483
|
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12520
|
-
|
|
12521
|
-
|
|
12522
|
-
|
|
12484
|
+
}, {
|
|
12485
|
+
key: "ready",
|
|
12486
|
+
get:
|
|
12487
|
+
/**
|
|
12488
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/ready
|
|
12489
|
+
* @example
|
|
12490
|
+
animation.pause();
|
|
12491
|
+
animation.ready.then(function() {
|
|
12492
|
+
// Displays 'running'
|
|
12493
|
+
alert(animation.playState);
|
|
12494
|
+
});
|
|
12495
|
+
animation.play();
|
|
12496
|
+
*/
|
|
12497
|
+
function get() {
|
|
12498
|
+
var _this2 = this;
|
|
12523
12499
|
|
|
12524
|
-
|
|
12525
|
-
|
|
12526
|
-
|
|
12500
|
+
if (!this.readyPromise) {
|
|
12501
|
+
if (this.timeline.animationsWithPromises.indexOf(this) === -1) {
|
|
12502
|
+
this.timeline.animationsWithPromises.push(this);
|
|
12503
|
+
}
|
|
12527
12504
|
|
|
12528
|
-
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
|
|
12532
|
-
result = [];
|
|
12505
|
+
this.readyPromise = new Promise(function (resolve, reject) {
|
|
12506
|
+
_this2.resolveReadyPromise = function () {
|
|
12507
|
+
resolve(_this2);
|
|
12508
|
+
};
|
|
12533
12509
|
|
|
12534
|
-
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
|
|
12510
|
+
_this2.rejectReadyPromise = function () {
|
|
12511
|
+
reject(new Error());
|
|
12512
|
+
};
|
|
12513
|
+
});
|
|
12514
|
+
|
|
12515
|
+
if (!this.pending) {
|
|
12516
|
+
this.resolveReadyPromise();
|
|
12517
|
+
}
|
|
12540
12518
|
}
|
|
12519
|
+
|
|
12520
|
+
return this.readyPromise;
|
|
12541
12521
|
}
|
|
12522
|
+
/**
|
|
12523
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/finished
|
|
12524
|
+
* @example
|
|
12525
|
+
Promise.all(
|
|
12526
|
+
elem.getAnimations().map(
|
|
12527
|
+
function(animation) {
|
|
12528
|
+
return animation.finished
|
|
12529
|
+
}
|
|
12530
|
+
)
|
|
12531
|
+
).then(
|
|
12532
|
+
function() {
|
|
12533
|
+
return elem.remove();
|
|
12534
|
+
}
|
|
12535
|
+
);
|
|
12536
|
+
*/
|
|
12542
12537
|
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12547
|
-
*/
|
|
12548
|
-
;
|
|
12538
|
+
}, {
|
|
12539
|
+
key: "finished",
|
|
12540
|
+
get: function get() {
|
|
12541
|
+
var _this3 = this;
|
|
12549
12542
|
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
|
|
12553
|
-
|
|
12543
|
+
if (!this.finishedPromise) {
|
|
12544
|
+
if (this.timeline.animationsWithPromises.indexOf(this) === -1) {
|
|
12545
|
+
this.timeline.animationsWithPromises.push(this);
|
|
12546
|
+
}
|
|
12554
12547
|
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12559
|
-
result = [];
|
|
12548
|
+
this.finishedPromise = new Promise(function (resolve, reject) {
|
|
12549
|
+
_this3.resolveFinishedPromise = function () {
|
|
12550
|
+
resolve(_this3);
|
|
12551
|
+
};
|
|
12560
12552
|
|
|
12561
|
-
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12565
|
-
result.push([startPoint[0], startPoint[1]]);
|
|
12566
|
-
result.push([endPoint[0], endPoint[1]]);
|
|
12567
|
-
}
|
|
12568
|
-
}
|
|
12553
|
+
_this3.rejectFinishedPromise = function () {
|
|
12554
|
+
reject(new Error());
|
|
12555
|
+
};
|
|
12556
|
+
});
|
|
12569
12557
|
|
|
12570
|
-
|
|
12571
|
-
|
|
12558
|
+
if (this.playState === 'finished') {
|
|
12559
|
+
this.resolveFinishedPromise();
|
|
12560
|
+
}
|
|
12561
|
+
}
|
|
12572
12562
|
|
|
12573
|
-
|
|
12574
|
-
}
|
|
12563
|
+
return this.finishedPromise;
|
|
12564
|
+
}
|
|
12565
|
+
/**
|
|
12566
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/onfinish
|
|
12567
|
+
*/
|
|
12575
12568
|
|
|
12576
|
-
|
|
12577
|
-
|
|
12578
|
-
|
|
12569
|
+
}, {
|
|
12570
|
+
key: "currentTime",
|
|
12571
|
+
get:
|
|
12572
|
+
/**
|
|
12573
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/currentTime
|
|
12574
|
+
*/
|
|
12575
|
+
function get() {
|
|
12576
|
+
this.updatePromises();
|
|
12577
|
+
return this._idle || this.currentTimePending ? null : this._currentTime;
|
|
12578
|
+
},
|
|
12579
|
+
set: function set(newTime) {
|
|
12580
|
+
newTime = Number(newTime);
|
|
12581
|
+
if (isNaN(newTime)) return;
|
|
12582
|
+
this.timeline.restart();
|
|
12579
12583
|
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
style = _ref.style,
|
|
12583
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
12584
|
+
if (!this._paused && this._startTime !== null) {
|
|
12585
|
+
var _this$timeline;
|
|
12584
12586
|
|
|
12585
|
-
|
|
12586
|
-
|
|
12587
|
-
style: _extends({
|
|
12588
|
-
points: '',
|
|
12589
|
-
miterLimit: 4
|
|
12590
|
-
}, style)
|
|
12591
|
-
}, rest)) || this;
|
|
12592
|
-
}
|
|
12587
|
+
this._startTime = Number((_this$timeline = this.timeline) === null || _this$timeline === void 0 ? void 0 : _this$timeline.currentTime) - newTime / this.playbackRate;
|
|
12588
|
+
}
|
|
12593
12589
|
|
|
12594
|
-
|
|
12595
|
-
}(DisplayObject);
|
|
12590
|
+
this.currentTimePending = false;
|
|
12596
12591
|
|
|
12597
|
-
|
|
12598
|
-
|
|
12599
|
-
|
|
12592
|
+
if (this._currentTime === newTime) {
|
|
12593
|
+
return;
|
|
12594
|
+
}
|
|
12600
12595
|
|
|
12601
|
-
|
|
12602
|
-
|
|
12603
|
-
|
|
12604
|
-
|
|
12596
|
+
if (this._idle) {
|
|
12597
|
+
this._idle = false;
|
|
12598
|
+
this._paused = true;
|
|
12599
|
+
}
|
|
12605
12600
|
|
|
12606
|
-
|
|
12607
|
-
|
|
12608
|
-
|
|
12609
|
-
|
|
12610
|
-
|
|
12611
|
-
|
|
12612
|
-
}, rest)) || this;
|
|
12613
|
-
}
|
|
12601
|
+
this.tickCurrentTime(newTime, true);
|
|
12602
|
+
this.timeline.applyDirtiedAnimation(this);
|
|
12603
|
+
}
|
|
12604
|
+
/**
|
|
12605
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/startTime
|
|
12606
|
+
*/
|
|
12614
12607
|
|
|
12615
|
-
|
|
12608
|
+
}, {
|
|
12609
|
+
key: "startTime",
|
|
12610
|
+
get: function get() {
|
|
12611
|
+
return this._startTime;
|
|
12612
|
+
},
|
|
12613
|
+
set: function set(newTime) {
|
|
12614
|
+
if (newTime !== null) {
|
|
12615
|
+
this.updatePromises();
|
|
12616
|
+
newTime = Number(newTime);
|
|
12617
|
+
if (isNaN(newTime)) return;
|
|
12618
|
+
if (this._paused || this._idle) return;
|
|
12619
|
+
this._startTime = newTime;
|
|
12620
|
+
this.tickCurrentTime((Number(this.timeline.currentTime) - this._startTime) * this.playbackRate);
|
|
12621
|
+
this.timeline.applyDirtiedAnimation(this);
|
|
12622
|
+
this.updatePromises();
|
|
12623
|
+
}
|
|
12624
|
+
}
|
|
12625
|
+
}, {
|
|
12626
|
+
key: "playbackRate",
|
|
12627
|
+
get: function get() {
|
|
12628
|
+
return this._playbackRate;
|
|
12629
|
+
},
|
|
12630
|
+
set: function set(value) {
|
|
12631
|
+
if (value === this._playbackRate) {
|
|
12632
|
+
return;
|
|
12633
|
+
}
|
|
12616
12634
|
|
|
12617
|
-
|
|
12618
|
-
|
|
12619
|
-
|
|
12635
|
+
this.updatePromises();
|
|
12636
|
+
var oldCurrentTime = this.currentTime;
|
|
12637
|
+
this._playbackRate = value;
|
|
12638
|
+
this.startTime = null;
|
|
12620
12639
|
|
|
12621
|
-
|
|
12622
|
-
|
|
12623
|
-
|
|
12624
|
-
|
|
12625
|
-
|
|
12626
|
-
points = _this$parsedStyle$poi.points,
|
|
12627
|
-
segments = _this$parsedStyle$poi.segments;
|
|
12628
|
-
var subt = 0;
|
|
12629
|
-
var index = 0;
|
|
12630
|
-
segments.forEach(function (v, i) {
|
|
12631
|
-
if (ratio >= v[0] && ratio <= v[1]) {
|
|
12632
|
-
subt = (ratio - v[0]) / (v[1] - v[0]);
|
|
12633
|
-
index = i;
|
|
12640
|
+
if (this.playState !== 'paused' && this.playState !== 'idle') {
|
|
12641
|
+
this._finishedFlag = false;
|
|
12642
|
+
this._idle = false;
|
|
12643
|
+
this.ensureAlive();
|
|
12644
|
+
this.timeline.applyDirtiedAnimation(this);
|
|
12634
12645
|
}
|
|
12635
|
-
});
|
|
12636
12646
|
|
|
12637
|
-
|
|
12638
|
-
|
|
12639
|
-
|
|
12647
|
+
if (oldCurrentTime !== null) {
|
|
12648
|
+
this.currentTime = oldCurrentTime;
|
|
12649
|
+
}
|
|
12640
12650
|
|
|
12641
|
-
|
|
12651
|
+
this.updatePromises();
|
|
12652
|
+
}
|
|
12653
|
+
}, {
|
|
12654
|
+
key: "_isFinished",
|
|
12655
|
+
get: function get() {
|
|
12656
|
+
return !this._idle && (this._playbackRate > 0 && Number(this._currentTime) >= this.totalDuration || this._playbackRate < 0 && Number(this._currentTime) <= 0);
|
|
12657
|
+
}
|
|
12658
|
+
}, {
|
|
12659
|
+
key: "totalDuration",
|
|
12660
|
+
get: function get() {
|
|
12661
|
+
var _this$effect4;
|
|
12642
12662
|
|
|
12643
|
-
|
|
12644
|
-
|
|
12663
|
+
return Number((_this$effect4 = this.effect) === null || _this$effect4 === void 0 ? void 0 : _this$effect4.getComputedTiming().endTime);
|
|
12664
|
+
}
|
|
12665
|
+
}, {
|
|
12666
|
+
key: "_needsTick",
|
|
12667
|
+
get: function get() {
|
|
12668
|
+
return this.pending || this.playState === 'running' || !this._finishedFlag;
|
|
12669
|
+
}
|
|
12670
|
+
}]);
|
|
12645
12671
|
|
|
12646
|
-
|
|
12647
|
-
|
|
12648
|
-
var result = [];
|
|
12649
|
-
result.push([points[1][0], points[1][1]]);
|
|
12650
|
-
result.push([points[0][0], points[0][1]]);
|
|
12651
|
-
return result;
|
|
12652
|
-
};
|
|
12672
|
+
return Animation;
|
|
12673
|
+
}();
|
|
12653
12674
|
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12657
|
-
|
|
12658
|
-
|
|
12659
|
-
|
|
12660
|
-
return result;
|
|
12661
|
-
};
|
|
12675
|
+
function compareAnimations(leftAnimation, rightAnimation) {
|
|
12676
|
+
return Number(leftAnimation.id) - Number(rightAnimation.id);
|
|
12677
|
+
}
|
|
12678
|
+
/**
|
|
12679
|
+
* @see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/web-animations-js/index.d.ts
|
|
12680
|
+
*/
|
|
12662
12681
|
|
|
12663
|
-
|
|
12664
|
-
|
|
12682
|
+
var AnimationTimeline = /*#__PURE__*/function () {
|
|
12683
|
+
/**
|
|
12684
|
+
* all active animations
|
|
12685
|
+
*/
|
|
12686
|
+
function AnimationTimeline(document) {
|
|
12687
|
+
var _this = this;
|
|
12665
12688
|
|
|
12666
|
-
|
|
12667
|
-
|
|
12668
|
-
|
|
12689
|
+
this.document = void 0;
|
|
12690
|
+
this.animations = [];
|
|
12691
|
+
this.ticking = false;
|
|
12692
|
+
this.timelineTicking = false;
|
|
12693
|
+
this.hasRestartedThisFrame = false;
|
|
12694
|
+
this.animationsWithPromises = [];
|
|
12695
|
+
this.inTick = false;
|
|
12696
|
+
this.pendingEffects = [];
|
|
12697
|
+
this.currentTime = null;
|
|
12698
|
+
this.rafId = 0;
|
|
12699
|
+
this.rafCallbacks = [];
|
|
12700
|
+
this.frameId = void 0;
|
|
12669
12701
|
|
|
12670
|
-
|
|
12671
|
-
|
|
12672
|
-
style = _ref.style,
|
|
12673
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
12702
|
+
this.webAnimationsNextTick = function (t) {
|
|
12703
|
+
_this.currentTime = t;
|
|
12674
12704
|
|
|
12675
|
-
|
|
12676
|
-
type: Shape.RECT,
|
|
12677
|
-
style: _extends({
|
|
12678
|
-
x: '',
|
|
12679
|
-
y: '',
|
|
12680
|
-
width: '',
|
|
12681
|
-
height: '',
|
|
12682
|
-
radius: ''
|
|
12683
|
-
}, style)
|
|
12684
|
-
}, rest)) || this;
|
|
12685
|
-
}
|
|
12705
|
+
_this.discardAnimations();
|
|
12686
12706
|
|
|
12687
|
-
|
|
12688
|
-
|
|
12707
|
+
if (_this.animations.length === 0) {
|
|
12708
|
+
_this.timelineTicking = false;
|
|
12709
|
+
} else {
|
|
12710
|
+
_this.requestAnimationFrame(_this.webAnimationsNextTick);
|
|
12711
|
+
}
|
|
12712
|
+
};
|
|
12689
12713
|
|
|
12690
|
-
|
|
12691
|
-
|
|
12692
|
-
|
|
12693
|
-
|
|
12714
|
+
this.processRafCallbacks = function (t) {
|
|
12715
|
+
var processing = _this.rafCallbacks;
|
|
12716
|
+
_this.rafCallbacks = [];
|
|
12717
|
+
if (t < Number(_this.currentTime)) t = Number(_this.currentTime);
|
|
12694
12718
|
|
|
12695
|
-
|
|
12696
|
-
_inheritsLoose(Text, _DisplayObject);
|
|
12719
|
+
_this.animations.sort(compareAnimations);
|
|
12697
12720
|
|
|
12698
|
-
|
|
12699
|
-
|
|
12700
|
-
|
|
12701
|
-
|
|
12702
|
-
var _this;
|
|
12721
|
+
_this.animations = _this.tick(t, true, _this.animations)[0];
|
|
12722
|
+
processing.forEach(function (entry) {
|
|
12723
|
+
entry[1](t);
|
|
12724
|
+
});
|
|
12703
12725
|
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
12726
|
+
_this.applyPendingEffects();
|
|
12727
|
+
};
|
|
12707
12728
|
|
|
12708
|
-
|
|
12709
|
-
type: Shape.TEXT,
|
|
12710
|
-
style: _extends({
|
|
12711
|
-
x: '',
|
|
12712
|
-
y: '',
|
|
12713
|
-
text: '',
|
|
12714
|
-
fontSize: '',
|
|
12715
|
-
fontFamily: '',
|
|
12716
|
-
fontStyle: '',
|
|
12717
|
-
fontWeight: '',
|
|
12718
|
-
fontVariant: '',
|
|
12719
|
-
textAlign: '',
|
|
12720
|
-
textBaseline: '',
|
|
12721
|
-
textTransform: '',
|
|
12722
|
-
// dropShadow: false,
|
|
12723
|
-
// dropShadowAlpha: 1,
|
|
12724
|
-
// dropShadowAngle: Math.PI / 6,
|
|
12725
|
-
// dropShadowBlur: 0,
|
|
12726
|
-
// dropShadowColor: '#000',
|
|
12727
|
-
// dropShadowDistance: 5,
|
|
12728
|
-
fill: 'black',
|
|
12729
|
-
// stroke: 'black',
|
|
12730
|
-
letterSpacing: 0,
|
|
12731
|
-
lineHeight: 0,
|
|
12732
|
-
miterLimit: 10,
|
|
12733
|
-
whiteSpace: 'pre',
|
|
12734
|
-
wordWrap: false,
|
|
12735
|
-
wordWrapWidth: 0,
|
|
12736
|
-
leading: 0,
|
|
12737
|
-
dx: '',
|
|
12738
|
-
dy: ''
|
|
12739
|
-
}, style)
|
|
12740
|
-
}, rest)) || this;
|
|
12741
|
-
_this.LENGTHADJUST_SPACING = 1;
|
|
12742
|
-
_this.LENGTHADJUST_SPACINGANDGLYPHS = 2;
|
|
12743
|
-
_this.LENGTHADJUST_UNKNOWN = 0;
|
|
12744
|
-
_this.lengthAdjust = void 0;
|
|
12745
|
-
_this.textLength = void 0;
|
|
12746
|
-
return _this;
|
|
12729
|
+
this.document = document;
|
|
12747
12730
|
}
|
|
12748
12731
|
|
|
12749
|
-
var _proto =
|
|
12732
|
+
var _proto = AnimationTimeline.prototype;
|
|
12733
|
+
|
|
12734
|
+
_proto.getAnimations = function getAnimations() {
|
|
12735
|
+
this.discardAnimations();
|
|
12736
|
+
return this.animations.slice();
|
|
12737
|
+
};
|
|
12738
|
+
|
|
12739
|
+
_proto.isTicking = function isTicking() {
|
|
12740
|
+
return this.inTick;
|
|
12741
|
+
};
|
|
12750
12742
|
|
|
12751
|
-
_proto.
|
|
12752
|
-
|
|
12753
|
-
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
|
|
12743
|
+
_proto.play = function play(effect) {
|
|
12744
|
+
var animation = new Animation(effect, this);
|
|
12745
|
+
this.animations.push(animation);
|
|
12746
|
+
this.restartWebAnimationsNextTick();
|
|
12747
|
+
animation.updatePromises();
|
|
12748
|
+
animation.play();
|
|
12749
|
+
animation.updatePromises();
|
|
12750
|
+
return animation;
|
|
12751
|
+
} // RAF is supposed to be the last script to occur before frame rendering but not
|
|
12752
|
+
// all browsers behave like this. This function is for synchonously updating an
|
|
12753
|
+
// animation's effects whenever its state is mutated by script to work around
|
|
12754
|
+
// incorrect script execution ordering by the browser.
|
|
12757
12755
|
;
|
|
12758
12756
|
|
|
12759
|
-
_proto.
|
|
12760
|
-
var
|
|
12757
|
+
_proto.applyDirtiedAnimation = function applyDirtiedAnimation(animation) {
|
|
12758
|
+
var _this2 = this;
|
|
12761
12759
|
|
|
12762
|
-
|
|
12763
|
-
|
|
12760
|
+
if (this.inTick) {
|
|
12761
|
+
return;
|
|
12762
|
+
} // update active animations in displayobject
|
|
12764
12763
|
|
|
12765
|
-
_proto.getEndPositionOfChar = function getEndPositionOfChar(charnum) {
|
|
12766
|
-
throw new Error('Method not implemented.');
|
|
12767
|
-
};
|
|
12768
12764
|
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12765
|
+
animation.markTarget();
|
|
12766
|
+
var animations = animation.targetAnimations();
|
|
12767
|
+
animations.sort(compareAnimations); // clear inactive animations
|
|
12772
12768
|
|
|
12773
|
-
|
|
12774
|
-
|
|
12775
|
-
|
|
12769
|
+
var inactiveAnimations = this.tick(Number(this.currentTime), false, animations.slice())[1];
|
|
12770
|
+
inactiveAnimations.forEach(function (animation) {
|
|
12771
|
+
var index = _this2.animations.indexOf(animation);
|
|
12776
12772
|
|
|
12777
|
-
|
|
12778
|
-
|
|
12773
|
+
if (index !== -1) {
|
|
12774
|
+
_this2.animations.splice(index, 1);
|
|
12775
|
+
}
|
|
12776
|
+
});
|
|
12777
|
+
this.applyPendingEffects();
|
|
12779
12778
|
};
|
|
12780
12779
|
|
|
12781
|
-
_proto.
|
|
12782
|
-
|
|
12783
|
-
|
|
12780
|
+
_proto.restart = function restart() {
|
|
12781
|
+
if (!this.ticking) {
|
|
12782
|
+
this.ticking = true;
|
|
12783
|
+
this.requestAnimationFrame(function () {});
|
|
12784
|
+
this.hasRestartedThisFrame = true;
|
|
12785
|
+
}
|
|
12784
12786
|
|
|
12785
|
-
|
|
12786
|
-
throw new Error('Method not implemented.');
|
|
12787
|
+
return this.hasRestartedThisFrame;
|
|
12787
12788
|
};
|
|
12788
12789
|
|
|
12789
|
-
_proto.
|
|
12790
|
-
|
|
12790
|
+
_proto.destroy = function destroy() {
|
|
12791
|
+
this.document.defaultView.cancelAnimationFrame(this.frameId);
|
|
12791
12792
|
};
|
|
12792
12793
|
|
|
12793
|
-
_proto.
|
|
12794
|
-
|
|
12795
|
-
|
|
12796
|
-
|
|
12794
|
+
_proto.applyPendingEffects = function applyPendingEffects() {
|
|
12795
|
+
this.pendingEffects.forEach(function (effect) {
|
|
12796
|
+
effect === null || effect === void 0 ? void 0 : effect.applyInterpolations();
|
|
12797
|
+
});
|
|
12798
|
+
this.pendingEffects = [];
|
|
12797
12799
|
};
|
|
12798
12800
|
|
|
12799
|
-
|
|
12800
|
-
|
|
12801
|
-
|
|
12802
|
-
|
|
12803
|
-
|
|
12804
|
-
* HTML container
|
|
12805
|
-
* @see https://github.com/pmndrs/drei#html
|
|
12806
|
-
*/
|
|
12801
|
+
_proto.updateAnimationsPromises = function updateAnimationsPromises() {
|
|
12802
|
+
this.animationsWithPromises = this.animationsWithPromises.filter(function (animation) {
|
|
12803
|
+
return animation.updatePromises();
|
|
12804
|
+
});
|
|
12805
|
+
};
|
|
12807
12806
|
|
|
12808
|
-
|
|
12809
|
-
|
|
12807
|
+
_proto.discardAnimations = function discardAnimations() {
|
|
12808
|
+
this.updateAnimationsPromises();
|
|
12809
|
+
this.animations = this.animations.filter(function (animation) {
|
|
12810
|
+
return animation.playState !== 'finished' && animation.playState !== 'idle';
|
|
12811
|
+
});
|
|
12812
|
+
};
|
|
12810
12813
|
|
|
12811
|
-
function
|
|
12812
|
-
|
|
12814
|
+
_proto.restartWebAnimationsNextTick = function restartWebAnimationsNextTick() {
|
|
12815
|
+
if (!this.timelineTicking) {
|
|
12816
|
+
this.timelineTicking = true;
|
|
12817
|
+
this.requestAnimationFrame(this.webAnimationsNextTick);
|
|
12818
|
+
}
|
|
12819
|
+
};
|
|
12813
12820
|
|
|
12814
|
-
|
|
12815
|
-
|
|
12816
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
12821
|
+
_proto.rAF = function rAF(f) {
|
|
12822
|
+
var id = this.rafId++;
|
|
12817
12823
|
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
x: '',
|
|
12822
|
-
y: '',
|
|
12823
|
-
width: 'auto',
|
|
12824
|
-
height: 'auto',
|
|
12825
|
-
innerHTML: ''
|
|
12826
|
-
}, style)
|
|
12827
|
-
}, rest)) || this;
|
|
12828
|
-
_this.cullable.enable = false;
|
|
12829
|
-
return _this;
|
|
12830
|
-
}
|
|
12831
|
-
/**
|
|
12832
|
-
* return wrapper HTMLElement
|
|
12833
|
-
* * <div> in g-webgl/canvas
|
|
12834
|
-
* * <foreignObject> in g-svg
|
|
12835
|
-
*/
|
|
12824
|
+
if (this.rafCallbacks.length === 0) {
|
|
12825
|
+
this.frameId = this.document.defaultView.requestAnimationFrame(this.processRafCallbacks);
|
|
12826
|
+
}
|
|
12836
12827
|
|
|
12828
|
+
this.rafCallbacks.push([id, f]);
|
|
12829
|
+
return id;
|
|
12830
|
+
};
|
|
12837
12831
|
|
|
12838
|
-
|
|
12832
|
+
_proto.requestAnimationFrame = function requestAnimationFrame(f) {
|
|
12833
|
+
var _this3 = this;
|
|
12839
12834
|
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
}
|
|
12843
|
-
/**
|
|
12844
|
-
* override with $el.getBoundingClientRect
|
|
12845
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getBoundingClientRect
|
|
12846
|
-
*/
|
|
12847
|
-
;
|
|
12835
|
+
return this.rAF(function (x) {
|
|
12836
|
+
_this3.updateAnimationsPromises();
|
|
12848
12837
|
|
|
12849
|
-
|
|
12850
|
-
return this.parsedStyle.$el.getBoundingClientRect();
|
|
12851
|
-
};
|
|
12838
|
+
f(x);
|
|
12852
12839
|
|
|
12853
|
-
|
|
12854
|
-
|
|
12840
|
+
_this3.updateAnimationsPromises();
|
|
12841
|
+
});
|
|
12855
12842
|
};
|
|
12856
12843
|
|
|
12857
|
-
_proto.
|
|
12858
|
-
var
|
|
12844
|
+
_proto.tick = function tick(t, isAnimationFrame, updatingAnimations) {
|
|
12845
|
+
var _this4 = this,
|
|
12846
|
+
_this$pendingEffects,
|
|
12847
|
+
_this$pendingEffects2;
|
|
12859
12848
|
|
|
12860
|
-
|
|
12861
|
-
|
|
12849
|
+
this.inTick = true;
|
|
12850
|
+
this.hasRestartedThisFrame = false;
|
|
12851
|
+
this.currentTime = t;
|
|
12852
|
+
this.ticking = false;
|
|
12853
|
+
var newPendingClears = [];
|
|
12854
|
+
var newPendingEffects = [];
|
|
12855
|
+
var activeAnimations = [];
|
|
12856
|
+
var inactiveAnimations = [];
|
|
12857
|
+
updatingAnimations.forEach(function (animation) {
|
|
12858
|
+
animation.tick(t, isAnimationFrame);
|
|
12862
12859
|
|
|
12863
|
-
|
|
12860
|
+
if (!animation._inEffect) {
|
|
12861
|
+
newPendingClears.push(animation.effect);
|
|
12862
|
+
animation.unmarkTarget();
|
|
12863
|
+
} else {
|
|
12864
|
+
newPendingEffects.push(animation.effect);
|
|
12865
|
+
animation.markTarget();
|
|
12866
|
+
}
|
|
12864
12867
|
|
|
12865
|
-
|
|
12866
|
-
var
|
|
12867
|
-
|
|
12868
|
-
var aabb = new AABB();
|
|
12869
|
-
aabb.setMinMax(vec3.fromValues(minX, minY, 0), vec3.fromValues(minX + clientRect.width, minY + clientRect.height, 0));
|
|
12870
|
-
return aabb;
|
|
12871
|
-
}
|
|
12868
|
+
if (animation._needsTick) _this4.ticking = true;
|
|
12869
|
+
var alive = animation._inEffect || animation._needsTick;
|
|
12870
|
+
animation._inTimeline = alive;
|
|
12872
12871
|
|
|
12873
|
-
|
|
12874
|
-
|
|
12872
|
+
if (alive) {
|
|
12873
|
+
activeAnimations.push(animation);
|
|
12874
|
+
} else {
|
|
12875
|
+
inactiveAnimations.push(animation);
|
|
12876
|
+
}
|
|
12877
|
+
});
|
|
12875
12878
|
|
|
12876
|
-
|
|
12877
|
-
if (this.parentNode) {
|
|
12878
|
-
var parentInvert = mat4.invert(mat4.create(), this.parentNode.getWorldTransform());
|
|
12879
|
-
var bounds = this.getBounds();
|
|
12879
|
+
(_this$pendingEffects = this.pendingEffects).push.apply(_this$pendingEffects, newPendingClears);
|
|
12880
12880
|
|
|
12881
|
-
|
|
12882
|
-
var localBounds = new AABB();
|
|
12883
|
-
localBounds.setFromTransformedAABB(bounds, parentInvert);
|
|
12884
|
-
return localBounds;
|
|
12885
|
-
}
|
|
12886
|
-
}
|
|
12881
|
+
(_this$pendingEffects2 = this.pendingEffects).push.apply(_this$pendingEffects2, newPendingEffects);
|
|
12887
12882
|
|
|
12888
|
-
|
|
12883
|
+
if (this.ticking) this.requestAnimationFrame(function () {});
|
|
12884
|
+
this.inTick = false;
|
|
12885
|
+
return [activeAnimations, inactiveAnimations];
|
|
12889
12886
|
};
|
|
12890
12887
|
|
|
12891
|
-
return
|
|
12892
|
-
}(
|
|
12888
|
+
return AnimationTimeline;
|
|
12889
|
+
}();
|
|
12893
12890
|
|
|
12894
12891
|
/**
|
|
12895
12892
|
* the entry of DOM tree
|
|
@@ -12924,7 +12921,7 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
12924
12921
|
defaultValue = _ref.defaultValue;
|
|
12925
12922
|
|
|
12926
12923
|
if (inherited && defaultValue) {
|
|
12927
|
-
initialStyle[name] = defaultValue;
|
|
12924
|
+
initialStyle[name] = isFunction(defaultValue) ? defaultValue(Shape.GROUP) : defaultValue;
|
|
12928
12925
|
}
|
|
12929
12926
|
}); // like <html> in DOM tree
|
|
12930
12927
|
|
|
@@ -12944,7 +12941,12 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
12944
12941
|
* @example const circle = document.createElement('circle', { style: { r: 10 } });
|
|
12945
12942
|
*/
|
|
12946
12943
|
_proto.createElement = function createElement(tagName, options) {
|
|
12947
|
-
//
|
|
12944
|
+
// @observablehq/plot will create <svg>
|
|
12945
|
+
if (tagName === 'svg') {
|
|
12946
|
+
return this.documentElement;
|
|
12947
|
+
} // d3 will use <tspan>
|
|
12948
|
+
|
|
12949
|
+
|
|
12948
12950
|
var clazz = this.defaultView.customElements.get(tagName);
|
|
12949
12951
|
|
|
12950
12952
|
if (!clazz) {
|
|
@@ -12952,7 +12954,9 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
12952
12954
|
clazz = tagName === 'tspan' ? Text : Group;
|
|
12953
12955
|
}
|
|
12954
12956
|
|
|
12955
|
-
|
|
12957
|
+
var shape = new clazz(options);
|
|
12958
|
+
shape.ownerDocument = this;
|
|
12959
|
+
return shape;
|
|
12956
12960
|
};
|
|
12957
12961
|
|
|
12958
12962
|
_proto.createElementNS = function createElementNS(namespaceURI, tagName, options) {
|
|
@@ -16617,20 +16621,15 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
16617
16621
|
|
|
16618
16622
|
if (this.renderingContext.renderReasons.size && this.inited) {
|
|
16619
16623
|
this.renderDisplayObject(this.renderingContext.root, canvasConfig);
|
|
16624
|
+
this.hooks.beginFrame.call();
|
|
16625
|
+
this.renderingContext.renderListCurrentFrame.forEach(function (object) {
|
|
16626
|
+
_this2.hooks.beforeRender.call(object);
|
|
16620
16627
|
|
|
16621
|
-
|
|
16622
|
-
this.hooks.beginFrame.call();
|
|
16623
|
-
this.renderingContext.renderListCurrentFrame.forEach(function (object) {
|
|
16624
|
-
_this2.hooks.beforeRender.call(object);
|
|
16625
|
-
|
|
16626
|
-
_this2.hooks.render.call(object);
|
|
16627
|
-
|
|
16628
|
-
_this2.hooks.afterRender.call(object);
|
|
16629
|
-
});
|
|
16630
|
-
this.hooks.endFrame.call();
|
|
16631
|
-
}
|
|
16628
|
+
_this2.hooks.render.call(object);
|
|
16632
16629
|
|
|
16633
|
-
|
|
16630
|
+
_this2.hooks.afterRender.call(object);
|
|
16631
|
+
});
|
|
16632
|
+
this.hooks.endFrame.call();
|
|
16634
16633
|
this.renderingContext.renderListCurrentFrame = [];
|
|
16635
16634
|
this.renderingContext.renderReasons.clear();
|
|
16636
16635
|
} // console.log('stats', this.stats);
|
|
@@ -18126,13 +18125,11 @@ var TextService = /*#__PURE__*/function () {
|
|
|
18126
18125
|
_proto.measureText = function measureText(text, parsedStyle, offscreenCanvas) {
|
|
18127
18126
|
var fontSize = parsedStyle.fontSize,
|
|
18128
18127
|
wordWrap = parsedStyle.wordWrap,
|
|
18129
|
-
|
|
18130
|
-
strokeHeight = _parsedStyle$lineHeig === void 0 ? 0 : _parsedStyle$lineHeig,
|
|
18128
|
+
strokeHeight = parsedStyle.lineHeight,
|
|
18131
18129
|
lineWidth = parsedStyle.lineWidth,
|
|
18132
18130
|
textBaseline = parsedStyle.textBaseline,
|
|
18133
18131
|
textAlign = parsedStyle.textAlign,
|
|
18134
|
-
|
|
18135
|
-
letterSpacing = _parsedStyle$letterSp === void 0 ? 0 : _parsedStyle$letterSp,
|
|
18132
|
+
letterSpacing = parsedStyle.letterSpacing,
|
|
18136
18133
|
_parsedStyle$leading = parsedStyle.leading,
|
|
18137
18134
|
leading = _parsedStyle$leading === void 0 ? 0 : _parsedStyle$leading;
|
|
18138
18135
|
var font = toFontString(parsedStyle);
|
|
@@ -18152,7 +18149,7 @@ var TextService = /*#__PURE__*/function () {
|
|
|
18152
18149
|
var maxLineWidth = 0;
|
|
18153
18150
|
|
|
18154
18151
|
for (var i = 0; i < lines.length; i++) {
|
|
18155
|
-
var _lineWidth = context.measureText(lines[i]).width + (lines[i].length - 1) * letterSpacing;
|
|
18152
|
+
var _lineWidth = context.measureText(lines[i]).width + (lines[i].length - 1) * letterSpacing.value;
|
|
18156
18153
|
|
|
18157
18154
|
lineWidths[i] = _lineWidth;
|
|
18158
18155
|
maxLineWidth = Math.max(maxLineWidth, _lineWidth);
|
|
@@ -18162,7 +18159,7 @@ var TextService = /*#__PURE__*/function () {
|
|
|
18162
18159
|
// width += dropShadowDistance;
|
|
18163
18160
|
// }
|
|
18164
18161
|
|
|
18165
|
-
var lineHeight = strokeHeight || fontProperties.fontSize + lineWidth.value;
|
|
18162
|
+
var lineHeight = strokeHeight.value || fontProperties.fontSize + lineWidth.value;
|
|
18166
18163
|
var height = Math.max(lineHeight, fontProperties.fontSize + lineWidth.value) + (lines.length - 1) * (lineHeight + leading); // if (dropShadow) {
|
|
18167
18164
|
// height += dropShadowDistance;
|
|
18168
18165
|
// }
|
|
@@ -18207,17 +18204,16 @@ var TextService = /*#__PURE__*/function () {
|
|
|
18207
18204
|
|
|
18208
18205
|
var _ref$wordWrapWidth = _ref.wordWrapWidth,
|
|
18209
18206
|
wordWrapWidth = _ref$wordWrapWidth === void 0 ? 0 : _ref$wordWrapWidth,
|
|
18210
|
-
|
|
18211
|
-
letterSpacing = _ref$letterSpacing === void 0 ? 0 : _ref$letterSpacing;
|
|
18207
|
+
letterSpacing = _ref.letterSpacing;
|
|
18212
18208
|
var context = this.offscreenCanvas.getOrCreateContext(offscreenCanvas);
|
|
18213
|
-
var maxWidth = wordWrapWidth + letterSpacing;
|
|
18209
|
+
var maxWidth = wordWrapWidth + letterSpacing.value;
|
|
18214
18210
|
var lines = [];
|
|
18215
18211
|
var currentIndex = 0;
|
|
18216
18212
|
var currentWidth = 0;
|
|
18217
18213
|
var cache = {};
|
|
18218
18214
|
|
|
18219
18215
|
var calcWidth = function calcWidth(char) {
|
|
18220
|
-
return _this2.getFromCache(char, letterSpacing, cache, context);
|
|
18216
|
+
return _this2.getFromCache(char, letterSpacing.value, cache, context);
|
|
18221
18217
|
};
|
|
18222
18218
|
|
|
18223
18219
|
Array.from(text).forEach(function (char, i) {
|
|
@@ -18802,7 +18798,7 @@ function getFontSize(object) {
|
|
|
18802
18798
|
return fontSize.clone();
|
|
18803
18799
|
}
|
|
18804
18800
|
|
|
18805
|
-
return
|
|
18801
|
+
return null;
|
|
18806
18802
|
}
|
|
18807
18803
|
/**
|
|
18808
18804
|
* <length> & <percentage>
|
|
@@ -18830,8 +18826,13 @@ var CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
|
|
|
18830
18826
|
} else if (computed.unit === UnitType.kEms) {
|
|
18831
18827
|
if (object.parentNode) {
|
|
18832
18828
|
var fontSize = getFontSize(object.parentNode);
|
|
18833
|
-
|
|
18834
|
-
|
|
18829
|
+
|
|
18830
|
+
if (fontSize) {
|
|
18831
|
+
fontSize.value *= computed.value;
|
|
18832
|
+
return fontSize;
|
|
18833
|
+
} else {
|
|
18834
|
+
registry.addUnresolveProperty(object, name);
|
|
18835
|
+
}
|
|
18835
18836
|
}
|
|
18836
18837
|
|
|
18837
18838
|
return new CSSUnitValue(0, 'px');
|
|
@@ -18841,8 +18842,12 @@ var CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
|
|
|
18841
18842
|
if (object === null || object === void 0 ? void 0 : (_object$ownerDocument = object.ownerDocument) === null || _object$ownerDocument === void 0 ? void 0 : _object$ownerDocument.documentElement) {
|
|
18842
18843
|
var _fontSize = getFontSize(object.ownerDocument.documentElement);
|
|
18843
18844
|
|
|
18844
|
-
_fontSize
|
|
18845
|
-
|
|
18845
|
+
if (_fontSize) {
|
|
18846
|
+
_fontSize.value *= computed.value;
|
|
18847
|
+
return _fontSize;
|
|
18848
|
+
} else {
|
|
18849
|
+
registry.addUnresolveProperty(object, name);
|
|
18850
|
+
}
|
|
18846
18851
|
}
|
|
18847
18852
|
|
|
18848
18853
|
return new CSSUnitValue(0, 'px');
|
|
@@ -19360,32 +19365,32 @@ var CSSPropertyTransform = /*#__PURE__*/function () {
|
|
|
19360
19365
|
|
|
19361
19366
|
if (t === 'scale') {
|
|
19362
19367
|
// scale(1) scale(1, 1)
|
|
19363
|
-
var newScale = d.map(function (s) {
|
|
19368
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
19364
19369
|
return s.value;
|
|
19365
|
-
}) || [1, 1];
|
|
19370
|
+
})) || [1, 1];
|
|
19366
19371
|
object.scaleLocal(newScale[0], newScale[1], 1);
|
|
19367
19372
|
} else if (t === 'scalex') {
|
|
19368
|
-
var _newScale = d.map(function (s) {
|
|
19373
|
+
var _newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
19369
19374
|
return s.value;
|
|
19370
|
-
}) || [1];
|
|
19375
|
+
})) || [1];
|
|
19371
19376
|
|
|
19372
19377
|
object.scaleLocal(_newScale[0], 1, 1);
|
|
19373
19378
|
} else if (t === 'scaley') {
|
|
19374
|
-
var _newScale2 = d.map(function (s) {
|
|
19379
|
+
var _newScale2 = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
19375
19380
|
return s.value;
|
|
19376
|
-
}) || [1];
|
|
19381
|
+
})) || [1];
|
|
19377
19382
|
|
|
19378
19383
|
object.scaleLocal(1, _newScale2[0], 1);
|
|
19379
19384
|
} else if (t === 'scalez') {
|
|
19380
|
-
var _newScale3 = d.map(function (s) {
|
|
19385
|
+
var _newScale3 = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
19381
19386
|
return s.value;
|
|
19382
|
-
}) || [1];
|
|
19387
|
+
})) || [1];
|
|
19383
19388
|
|
|
19384
19389
|
object.scaleLocal(1, 1, _newScale3[0]);
|
|
19385
19390
|
} else if (t === 'scale3d') {
|
|
19386
|
-
var _newScale4 = d.map(function (s) {
|
|
19391
|
+
var _newScale4 = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
19387
19392
|
return s.value;
|
|
19388
|
-
}) || [1, 1, 1];
|
|
19393
|
+
})) || [1, 1, 1];
|
|
19389
19394
|
|
|
19390
19395
|
object.scaleLocal(_newScale4[0], _newScale4[1], _newScale4[2]);
|
|
19391
19396
|
} else if (t === 'translate') {
|
|
@@ -19423,22 +19428,42 @@ var CSSPropertyTransform = /*#__PURE__*/function () {
|
|
|
19423
19428
|
|
|
19424
19429
|
object.rotateLocal(0, 0, _newAngles3[0].value);
|
|
19425
19430
|
} else if (t === 'rotate3d') ; else if (t === 'skew') {
|
|
19426
|
-
var newSkew = d.map(function (s) {
|
|
19431
|
+
var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
19427
19432
|
return s.value;
|
|
19428
|
-
}) || [0, 0];
|
|
19433
|
+
})) || [0, 0];
|
|
19429
19434
|
object.setLocalSkew(deg2rad(newSkew[0]), deg2rad(newSkew[1]));
|
|
19430
19435
|
} else if (t === 'skewx') {
|
|
19431
|
-
var _newSkew = d.map(function (s) {
|
|
19436
|
+
var _newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
19432
19437
|
return s.value;
|
|
19433
|
-
}) || [0];
|
|
19438
|
+
})) || [0];
|
|
19434
19439
|
|
|
19435
19440
|
object.setLocalSkew(deg2rad(_newSkew[0]), object.getLocalSkew()[1]);
|
|
19436
19441
|
} else if (t === 'skewy') {
|
|
19437
|
-
var _newSkew2 = d.map(function (s) {
|
|
19442
|
+
var _newSkew2 = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
19438
19443
|
return s.value;
|
|
19439
|
-
}) || [0];
|
|
19444
|
+
})) || [0];
|
|
19440
19445
|
|
|
19441
19446
|
object.setLocalSkew(object.getLocalSkew()[0], deg2rad(_newSkew2[0]));
|
|
19447
|
+
} else if (t === 'matrix') {
|
|
19448
|
+
var _d$map = d.map(function (s) {
|
|
19449
|
+
return s.value;
|
|
19450
|
+
}),
|
|
19451
|
+
a = _d$map[0],
|
|
19452
|
+
b = _d$map[1],
|
|
19453
|
+
c = _d$map[2],
|
|
19454
|
+
dd = _d$map[3],
|
|
19455
|
+
tx = _d$map[4],
|
|
19456
|
+
ty = _d$map[5];
|
|
19457
|
+
|
|
19458
|
+
object.setLocalTransform(mat4.fromValues(a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx + defX, ty + defY, 0, 1));
|
|
19459
|
+
} else if (t === 'matrix3d') {
|
|
19460
|
+
// @ts-ignore
|
|
19461
|
+
var mat = mat4.fromValues.apply(mat4, d.map(function (s) {
|
|
19462
|
+
return s.value;
|
|
19463
|
+
}));
|
|
19464
|
+
mat[12] += defX;
|
|
19465
|
+
mat[13] += defY;
|
|
19466
|
+
object.setLocalTransform(mat);
|
|
19442
19467
|
}
|
|
19443
19468
|
});
|
|
19444
19469
|
}
|
|
@@ -19568,6 +19593,11 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
19568
19593
|
keywords: ['none'],
|
|
19569
19594
|
defaultValue: 'none',
|
|
19570
19595
|
syntax: PropertySyntax.PAINT
|
|
19596
|
+
}, {
|
|
19597
|
+
name: 'shadowType',
|
|
19598
|
+
keywords: ['inner', 'outer', 'both'],
|
|
19599
|
+
defaultValue: 'outer',
|
|
19600
|
+
layoutDependent: true
|
|
19571
19601
|
}, {
|
|
19572
19602
|
name: 'shadowColor',
|
|
19573
19603
|
interpolable: true,
|
|
@@ -19704,6 +19734,10 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
19704
19734
|
return 'center';
|
|
19705
19735
|
}
|
|
19706
19736
|
|
|
19737
|
+
if (nodeName === Shape.TEXT) {
|
|
19738
|
+
return 'text-anchor';
|
|
19739
|
+
}
|
|
19740
|
+
|
|
19707
19741
|
return 'left top';
|
|
19708
19742
|
},
|
|
19709
19743
|
layoutDependent: true,
|
|
@@ -19895,16 +19929,27 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
19895
19929
|
defaultValue: 'normal'
|
|
19896
19930
|
}, {
|
|
19897
19931
|
name: 'lineHeight',
|
|
19898
|
-
layoutDependent: true
|
|
19899
|
-
|
|
19900
|
-
|
|
19901
|
-
|
|
19932
|
+
layoutDependent: true,
|
|
19933
|
+
syntax: PropertySyntax.LENGTH,
|
|
19934
|
+
interpolable: true,
|
|
19935
|
+
defaultValue: '0'
|
|
19902
19936
|
}, {
|
|
19903
19937
|
name: 'letterSpacing',
|
|
19904
|
-
layoutDependent: true
|
|
19905
|
-
|
|
19906
|
-
|
|
19938
|
+
layoutDependent: true,
|
|
19939
|
+
syntax: PropertySyntax.LENGTH,
|
|
19940
|
+
interpolable: true,
|
|
19941
|
+
defaultValue: '0'
|
|
19942
|
+
}, {
|
|
19943
|
+
name: 'miterLimit',
|
|
19944
|
+
layoutDependent: true,
|
|
19945
|
+
syntax: PropertySyntax.NUMBER,
|
|
19946
|
+
defaultValue: function defaultValue(nodeName) {
|
|
19947
|
+
if (nodeName === Shape.PATH || nodeName === Shape.POLYGON || nodeName === Shape.POLYLINE) {
|
|
19948
|
+
return '4';
|
|
19949
|
+
}
|
|
19907
19950
|
|
|
19951
|
+
return '10';
|
|
19952
|
+
}
|
|
19908
19953
|
}, {
|
|
19909
19954
|
name: 'wordWrap',
|
|
19910
19955
|
layoutDependent: true
|
|
@@ -20297,8 +20342,10 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
20297
20342
|
|
|
20298
20343
|
var halfExtents = vec3.fromValues(Math.abs(width) / 2, Math.abs(height) / 2, depth / 2); // anchor is center by default, don't account for lineWidth here
|
|
20299
20344
|
|
|
20300
|
-
var
|
|
20345
|
+
var stroke = parsedStyle.stroke,
|
|
20346
|
+
lineWidth = parsedStyle.lineWidth,
|
|
20301
20347
|
increasedLineWidthForHitTesting = parsedStyle.increasedLineWidthForHitTesting,
|
|
20348
|
+
shadowType = parsedStyle.shadowType,
|
|
20302
20349
|
shadowColor = parsedStyle.shadowColor,
|
|
20303
20350
|
_parsedStyle$filter = parsedStyle.filter,
|
|
20304
20351
|
filter = _parsedStyle$filter === void 0 ? [] : _parsedStyle$filter,
|
|
@@ -20319,13 +20366,18 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
20319
20366
|
// if (lineJoin?.value === 'miter' && expansion < Math.SQRT2 * miterLimit) {
|
|
20320
20367
|
// expansion = Math.SQRT1_2 * miterLimit;
|
|
20321
20368
|
// }
|
|
20369
|
+
// append border only if stroke existed
|
|
20370
|
+
|
|
20371
|
+
var hasStroke = stroke && !stroke.isNone;
|
|
20322
20372
|
|
|
20323
|
-
|
|
20373
|
+
if (hasStroke) {
|
|
20374
|
+
var halfLineWidth = (((lineWidth === null || lineWidth === void 0 ? void 0 : lineWidth.value) || 0) + ((increasedLineWidthForHitTesting === null || increasedLineWidthForHitTesting === void 0 ? void 0 : increasedLineWidthForHitTesting.value) || 0)) * expansion;
|
|
20375
|
+
vec3.add(halfExtents, halfExtents, vec3.fromValues(halfLineWidth, halfLineWidth, 0));
|
|
20376
|
+
}
|
|
20324
20377
|
|
|
20325
|
-
vec3.add(halfExtents, halfExtents, vec3.fromValues(halfLineWidth, halfLineWidth, 0));
|
|
20326
20378
|
geometry.renderBounds.update(center, halfExtents); // account for shadow, only support constant value now
|
|
20327
20379
|
|
|
20328
|
-
if (shadowColor) {
|
|
20380
|
+
if (shadowColor && (shadowType === null || shadowType === void 0 ? void 0 : shadowType.value) !== 'inner') {
|
|
20329
20381
|
var _geometry$renderBound = geometry.renderBounds,
|
|
20330
20382
|
min = _geometry$renderBound.min,
|
|
20331
20383
|
max = _geometry$renderBound.max;
|
|
@@ -20577,6 +20629,9 @@ var containerModule = Module(function (register) {
|
|
|
20577
20629
|
});
|
|
20578
20630
|
});
|
|
20579
20631
|
|
|
20632
|
+
var AbstractRendererPlugin = function AbstractRendererPlugin() {
|
|
20633
|
+
this.container = void 0;
|
|
20634
|
+
};
|
|
20580
20635
|
var AbstractRenderer = /*#__PURE__*/function () {
|
|
20581
20636
|
function AbstractRenderer(config) {
|
|
20582
20637
|
this.plugins = [];
|
|
@@ -20596,7 +20651,8 @@ var AbstractRenderer = /*#__PURE__*/function () {
|
|
|
20596
20651
|
/**
|
|
20597
20652
|
* enable dirty rectangle rendering by default
|
|
20598
20653
|
*/
|
|
20599
|
-
enableDirtyRectangleRendering: true
|
|
20654
|
+
enableDirtyRectangleRendering: true,
|
|
20655
|
+
enableDirtyRectangleRenderingDebug: false
|
|
20600
20656
|
}, config);
|
|
20601
20657
|
}
|
|
20602
20658
|
|
|
@@ -20684,9 +20740,8 @@ var CullingPlugin = CullingPlugin_1 = (_class$1 = /*#__PURE__*/function () {
|
|
|
20684
20740
|
if (!cullable.isCulled() && object.isVisible()) {
|
|
20685
20741
|
return object;
|
|
20686
20742
|
} else {
|
|
20687
|
-
if (
|
|
20688
|
-
|
|
20689
|
-
}
|
|
20743
|
+
// if (this.renderingContext.renderListLastFrame.indexOf(object) > -1) {
|
|
20744
|
+
object.dispatchEvent(new CustomEvent(ElementEvent.CULLED)); // }
|
|
20690
20745
|
}
|
|
20691
20746
|
|
|
20692
20747
|
return null;
|
|
@@ -21357,6 +21412,7 @@ var CanvasEvent;
|
|
|
21357
21412
|
CanvasEvent["BEFORE_DESTROY"] = "beforedestroy";
|
|
21358
21413
|
CanvasEvent["AFTER_DESTROY"] = "afterdestroy";
|
|
21359
21414
|
CanvasEvent["RESIZE"] = "resize";
|
|
21415
|
+
CanvasEvent["DIRTY_RECTANGLE"] = "dirtyrectangle";
|
|
21360
21416
|
})(CanvasEvent || (CanvasEvent = {}));
|
|
21361
21417
|
/**
|
|
21362
21418
|
* can be treated like Window in DOM
|
|
@@ -21560,7 +21616,6 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
21560
21616
|
* the root node in scene graph
|
|
21561
21617
|
*/
|
|
21562
21618
|
root: this.document.documentElement,
|
|
21563
|
-
renderListLastFrame: [],
|
|
21564
21619
|
renderListCurrentFrame: [],
|
|
21565
21620
|
unculledEntities: [],
|
|
21566
21621
|
renderReasons: new Set(),
|
|
@@ -21841,14 +21896,13 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
21841
21896
|
// load other container modules provided by g-canvas/g-svg/g-webgl
|
|
21842
21897
|
var plugins = renderer.getPlugins();
|
|
21843
21898
|
plugins.forEach(function (plugin) {
|
|
21844
|
-
plugin.
|
|
21899
|
+
plugin.container = _this4.container;
|
|
21900
|
+
plugin.init();
|
|
21845
21901
|
});
|
|
21846
21902
|
};
|
|
21847
21903
|
|
|
21848
21904
|
_proto.setRenderer = /*#__PURE__*/function () {
|
|
21849
21905
|
var _setRenderer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(renderer) {
|
|
21850
|
-
var _this5 = this;
|
|
21851
|
-
|
|
21852
21906
|
var canvasConfig, oldRenderer;
|
|
21853
21907
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
21854
21908
|
while (1) {
|
|
@@ -21871,7 +21925,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
21871
21925
|
this.destroy(false, true); // destroy all plugins, reverse will mutate origin array
|
|
21872
21926
|
|
|
21873
21927
|
[].concat(oldRenderer === null || oldRenderer === void 0 ? void 0 : oldRenderer.getPlugins()).reverse().forEach(function (plugin) {
|
|
21874
|
-
plugin.destroy(
|
|
21928
|
+
plugin.destroy();
|
|
21875
21929
|
});
|
|
21876
21930
|
_context3.next = 9;
|
|
21877
21931
|
return this.initRenderer(renderer);
|
|
@@ -21896,7 +21950,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
21896
21950
|
};
|
|
21897
21951
|
|
|
21898
21952
|
_proto.unmountChildren = function unmountChildren(parent) {
|
|
21899
|
-
var
|
|
21953
|
+
var _this5 = this;
|
|
21900
21954
|
|
|
21901
21955
|
if (this.inited) {
|
|
21902
21956
|
var path = [];
|
|
@@ -21916,7 +21970,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
21916
21970
|
|
|
21917
21971
|
child.dispatchEvent(new CustomEvent(ElementEvent.UNMOUNTED)); // skip document.documentElement
|
|
21918
21972
|
|
|
21919
|
-
if (child !==
|
|
21973
|
+
if (child !== _this5.document.documentElement) {
|
|
21920
21974
|
child.ownerDocument = null;
|
|
21921
21975
|
}
|
|
21922
21976
|
|
|
@@ -21926,12 +21980,12 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
21926
21980
|
};
|
|
21927
21981
|
|
|
21928
21982
|
_proto.mountChildren = function mountChildren(parent) {
|
|
21929
|
-
var
|
|
21983
|
+
var _this6 = this;
|
|
21930
21984
|
|
|
21931
21985
|
if (this.inited) {
|
|
21932
21986
|
parent.forEach(function (child) {
|
|
21933
21987
|
if (!child.isConnected) {
|
|
21934
|
-
child.ownerDocument =
|
|
21988
|
+
child.ownerDocument = _this6.document;
|
|
21935
21989
|
child.isConnected = true;
|
|
21936
21990
|
child.dispatchEvent(new CustomEvent(ElementEvent.MOUNTED)); // trigger after mounted
|
|
21937
21991
|
|
|
@@ -21990,12 +22044,12 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
21990
22044
|
_createClass(Canvas, [{
|
|
21991
22045
|
key: "ready",
|
|
21992
22046
|
get: function get() {
|
|
21993
|
-
var
|
|
22047
|
+
var _this7 = this;
|
|
21994
22048
|
|
|
21995
22049
|
if (!this.readyPromise) {
|
|
21996
22050
|
this.readyPromise = new Promise(function (resolve) {
|
|
21997
|
-
|
|
21998
|
-
resolve(
|
|
22051
|
+
_this7.resolveReadyPromise = function () {
|
|
22052
|
+
resolve(_this7);
|
|
21999
22053
|
};
|
|
22000
22054
|
});
|
|
22001
22055
|
|
|
@@ -22011,8 +22065,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
22011
22065
|
return Canvas;
|
|
22012
22066
|
}(EventTarget);
|
|
22013
22067
|
|
|
22014
|
-
// import * as ManaSyringe from 'mana-syringe';
|
|
22015
22068
|
GlobalContainer.load(containerModule);
|
|
22016
22069
|
var layoutEngine = GlobalContainer.get(LayoutEngine);
|
|
22017
22070
|
|
|
22018
|
-
export { AABB, AbstractLayoutDefinition, AbstractRenderer, Animation, AnimationEffectTiming, AnimationEvent, AnimationTimeline, AsyncParallelHook, AsyncSeriesWaterfallHook, BUILT_IN_PROPERTIES, BaseType, BoundingSphere, CSS, CSSColorValue, CSSGradientValue, CSSKeywordValue, CSSMathInvert, CSSMathMax, CSSMathMin, CSSMathNegate, CSSMathOperator, CSSMathProduct, CSSMathSum, CSSMathValue, CSSMathVariadic, CSSNumericValue, CSSNumericValueType, CSSProperty, CSSPropertyAngle, CSSPropertyClipPath, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLengthOrPercentage12, CSSPropertyLengthOrPercentage14, CSSPropertyLocalPosition, CSSPropertyNumber, CSSPropertyOffsetDistance, CSSPropertyOffsetPath, CSSPropertyOpacity, CSSPropertyPath, CSSPropertyPoints, CSSPropertyShadowBlur, CSSPropertySyntaxFactory, CSSPropertyText, CSSPropertyTextTransform, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyZIndex, CSSRGB, CSSStyleValue, CSSStyleValueType, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasConfig, CanvasEvent, Circle, CircleUpdater, ContextNode, ContextService, Cullable, CustomElement, CustomElementRegistry, CustomEvent, DCHECK, DCHECK_EQ, DCHECK_NE, DELEGATION_SPLITTER, DefaultCamera, DefaultSceneGraphSelector, DefaultSceneGraphService, DefaultStyleValueRegistry, Deferred, DisplayObject, DisplayObjectPool, Document, EasingFunctions, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FragmentResult, FragmentResultFactory, FragmentResultOptions, Frustum, Geometry, GeometryAABBUpdater, GeometryUpdaterFactory, GradientType, Group, HTML, Image, KeyframeEffect, LayoutChildren, LayoutChildrenFactory, LayoutChildrenOptions, LayoutContext, LayoutContextFactory, LayoutContextOptions, LayoutEdges, LayoutEdgesFactory, LayoutEdgesOptions, LayoutEngine, LayoutFragment, LayoutFragmentFactory, LayoutFragmentOptions, LayoutObject, LayoutRegistry, LayoutTaskType, Line, LineUpdater, MOUSE_POINTER_ID, Mask, MutationEvent, MutationObserver, MutationRecord, Nested, Node, ObjectTyped, Odeg, OffscreenCanvasCreator, Opx, ParenLess, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertyName, PropertySyntax, RBushNode, RBushRoot, Ray, Rect, RectUpdater, Rectangle, Registration, RenderReason, Renderable, RenderingContext, RenderingPluginContribution, RenderingService, SceneGraphSelector, SceneGraphSelectorFactory, SceneGraphService, Shape, Sortable, Strategy, StyleValueRegistry, SyncHook, SyncWaterfallHook, TOUCH_TO_POINTER, Text, TextService, TextUpdater, Transform, UnitCategory, UnitType, ValueRange, baseTypeToString, camelCase, clamp, clampedMergeNumbers, cleanExistedCanvas, colorStopToString, compareAnimations, computeLinearGradient, computeRadialGradient, convertAngleUnit, convertEffectInput, convertItemToMatrix, convertPercentUnit, convertToDash, convertToPath, createVec3, decompose, deg2rad, deg2turn, equalSet, extractPolygons, formatAttribute, fromRotationTranslationScale, getAngle, getEasingFunction, getEuler, getHeight, getRotationInRadians, getScaling, getStyle, getTranslation, getWidth, grad2deg, hasArcOrBezier, isBoolean, isBrowser, isComparison, isFunction, isNil, isNumber, isObject, isPattern, isString, isUndefined, layoutEngine, makePerspective, makeQuerablePromise, makeTiming, memoize, mergeColors, mergeDimensionList, mergeDimensions, mergeNumberLists, mergeNumbers, mergePaths, mergeTransforms, normalizeKeyframes, normalizeTimingInput, numberToString, numericTimingToObject, parseAngle, parseColor, parseDimension, parseDimensionArray, parseFilter, parseGradient, parseLength, parseLengthOrPercentage, parseNumber, parseNumberList, parseParam, parsePath, parsePoints, parseTransform, parseTransformOrigin, parserPercentage, path2Segments, rad2deg, setDOMSize, sortByZIndex, toFontString, translatePathToString, turn2deg, typeCheck, unitTypeToBaseType };
|
|
22071
|
+
export { AABB, AbstractLayoutDefinition, AbstractRenderer, AbstractRendererPlugin, Animation, AnimationEffectTiming, AnimationEvent, AnimationTimeline, AsyncParallelHook, AsyncSeriesWaterfallHook, BUILT_IN_PROPERTIES, BaseType, BoundingSphere, CSS, CSSColorValue, CSSGradientValue, CSSKeywordValue, CSSMathInvert, CSSMathMax, CSSMathMin, CSSMathNegate, CSSMathOperator, CSSMathProduct, CSSMathSum, CSSMathValue, CSSMathVariadic, CSSNumericValue, CSSNumericValueType, CSSProperty, CSSPropertyAngle, CSSPropertyClipPath, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLengthOrPercentage12, CSSPropertyLengthOrPercentage14, CSSPropertyLocalPosition, CSSPropertyNumber, CSSPropertyOffsetDistance, CSSPropertyOffsetPath, CSSPropertyOpacity, CSSPropertyPath, CSSPropertyPoints, CSSPropertyShadowBlur, CSSPropertySyntaxFactory, CSSPropertyText, CSSPropertyTextTransform, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyZIndex, CSSRGB, CSSStyleValue, CSSStyleValueType, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasConfig, CanvasEvent, Circle, CircleUpdater, ContextNode, ContextService, Cullable, CustomElement, CustomElementRegistry, CustomEvent, DCHECK, DCHECK_EQ, DCHECK_NE, DELEGATION_SPLITTER, DefaultCamera, DefaultSceneGraphSelector, DefaultSceneGraphService, DefaultStyleValueRegistry, Deferred, DisplayObject, DisplayObjectPool, Document, EasingFunctions, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FragmentResult, FragmentResultFactory, FragmentResultOptions, Frustum, Geometry, GeometryAABBUpdater, GeometryUpdaterFactory, GradientType, Group, HTML, Image, KeyframeEffect, LayoutChildren, LayoutChildrenFactory, LayoutChildrenOptions, LayoutContext, LayoutContextFactory, LayoutContextOptions, LayoutEdges, LayoutEdgesFactory, LayoutEdgesOptions, LayoutEngine, LayoutFragment, LayoutFragmentFactory, LayoutFragmentOptions, LayoutObject, LayoutRegistry, LayoutTaskType, Line, LineUpdater, MOUSE_POINTER_ID, Mask, MutationEvent, MutationObserver, MutationRecord, Nested, Node, ObjectTyped, Odeg, OffscreenCanvasCreator, Opx, ParenLess, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertyName, PropertySyntax, RBushNode, RBushRoot, Ray, Rect, RectUpdater, Rectangle, Registration, RenderReason, Renderable, RenderingContext, RenderingPluginContribution, RenderingService, SceneGraphSelector, SceneGraphSelectorFactory, SceneGraphService, Shape, Sortable, Strategy, StyleValueRegistry, SyncHook, SyncWaterfallHook, TOUCH_TO_POINTER, Text, TextService, TextUpdater, Transform, UnitCategory, UnitType, ValueRange, baseTypeToString, camelCase, clamp, clampedMergeNumbers, cleanExistedCanvas, colorStopToString, compareAnimations, composeMatrix, computeLinearGradient, computeRadialGradient, convertAngleUnit, convertEffectInput, convertItemToMatrix, convertPercentUnit, convertToDash, convertToPath, createVec3, decompose, deg2rad, deg2turn, equalSet, extractPolygons, formatAttribute, fromRotationTranslationScale, getAngle, getEasingFunction, getEuler, getHeight, getRotationInRadians, getScaling, getStyle, getTranslation, getWidth, grad2deg, hasArcOrBezier, isBoolean, isBrowser, isComparison, isFunction, isNil, isNumber, isObject, isPattern, isString, isUndefined, layoutEngine, makePerspective, makeQuerablePromise, makeTiming, memoize, mergeColors, mergeDimensionList, mergeDimensions, mergeNumberLists, mergeNumbers, mergePaths, mergeTransforms, normalizeKeyframes, normalizeTimingInput, numberToString, numericTimingToObject, parseAngle, parseColor, parseDimension, parseDimensionArray, parseFilter, parseGradient, parseLength, parseLengthOrPercentage, parseNumber, parseNumberList, parseParam, parsePath, parsePoints, parseTransform, parseTransformOrigin, parserPercentage, path2Segments, rad2deg, setDOMSize, sortByZIndex, toFontString, translatePathToString, turn2deg, typeCheck, unitTypeToBaseType };
|