@galacean/engine-ui 1.5.8 → 1.5.9

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/browser.js CHANGED
@@ -527,13 +527,12 @@
527
527
  return _this;
528
528
  }
529
529
  var _proto = UITransform.prototype;
530
- /**
531
- * @internal
532
- */ _proto._copyFrom = function _copyFrom(transform) {
530
+ // @ts-ignore
531
+ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
533
532
  // @ts-ignore
534
- Transform.prototype._copyFrom.call(this, transform);
535
- this._size.copyFrom(transform.size);
536
- this._pivot.copyFrom(transform.pivot);
533
+ Transform.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
534
+ target.size.copyFrom(this._size);
535
+ target.pivot.copyFrom(this._pivot);
537
536
  };
538
537
  _proto._onSizeChange = function _onSizeChange() {
539
538
  // @ts-ignore
@@ -844,7 +843,7 @@
844
843
  _inherits(UIInteractive, Script);
845
844
  function UIInteractive(entity) {
846
845
  var _this;
847
- _this = Script.call(this, entity) || this, /** @internal */ _this._indexInRootCanvas = -1, /** @internal */ _this._isRootCanvasDirty = false, /** @internal */ _this._rootCanvasListeningEntities = [], /** @internal */ _this._indexInGroup = -1, /** @internal */ _this._isGroupDirty = false, /** @internal */ _this._groupListeningEntities = [], /** @internal */ _this._globalInteractive = false, /** @internal */ _this._globalInteractiveDirty = false, _this._interactive = true, _this._state = 0, _this._transitions = [], /** @todo Multi-touch points are not considered yet. */ _this._isPointerInside = false, _this._isPointerDragging = false;
846
+ _this = Script.call(this, entity) || this, /** @internal */ _this._indexInRootCanvas = -1, /** @internal */ _this._isRootCanvasDirty = false, /** @internal */ _this._rootCanvasListeningEntities = [], /** @internal */ _this._indexInGroup = -1, /** @internal */ _this._isGroupDirty = false, /** @internal */ _this._groupListeningEntities = [], /** @internal */ _this._globalInteractive = false, /** @internal */ _this._globalInteractiveDirty = false, _this._transitions = [], _this._interactive = true, _this._state = 0, /** @todo Multi-touch points are not considered yet. */ _this._isPointerInside = false, _this._isPointerDragging = false;
848
847
  _this._groupListener = _this._groupListener.bind(_this);
849
848
  _this._rootCanvasListener = _this._rootCanvasListener.bind(_this);
850
849
  return _this;
@@ -917,6 +916,26 @@
917
916
  transitions[i].destroy();
918
917
  }
919
918
  };
919
+ // @ts-ignore
920
+ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
921
+ var transitions = this._transitions;
922
+ for(var i = 0, n = transitions.length; i < n; i++){
923
+ var srcTransition = transitions[i];
924
+ var dstTransition = new transitions[i].constructor();
925
+ dstTransition.normal = srcTransition.normal;
926
+ dstTransition.pressed = srcTransition.pressed;
927
+ dstTransition.hover = srcTransition.hover;
928
+ dstTransition.disabled = srcTransition.disabled;
929
+ var transitionTarget = srcTransition.target;
930
+ if (transitionTarget) {
931
+ var paths = UIInteractive._targetTempPath;
932
+ // @ts-ignore
933
+ var success = engine.Entity._getEntityHierarchyPath(srcRoot, transitionTarget.entity, paths);
934
+ dstTransition.target = success ? engine.Entity._getEntityByHierarchyPath(targetRoot, paths).getComponent(transitionTarget.constructor) : transitionTarget;
935
+ }
936
+ target.addTransition(dstTransition);
937
+ }
938
+ };
920
939
  /**
921
940
  * @internal
922
941
  */ _proto._getRootCanvas = function _getRootCanvas() {
@@ -1027,6 +1046,7 @@
1027
1046
  ]);
1028
1047
  return UIInteractive;
1029
1048
  }(engine.Script);
1049
+ UIInteractive._targetTempPath = new Array();
1030
1050
  __decorate([
1031
1051
  engine.ignoreClone
1032
1052
  ], UIInteractive.prototype, "_rootCanvas", void 0);
@@ -1057,6 +1077,9 @@
1057
1077
  __decorate([
1058
1078
  engine.ignoreClone
1059
1079
  ], UIInteractive.prototype, "_globalInteractiveDirty", void 0);
1080
+ __decorate([
1081
+ engine.ignoreClone
1082
+ ], UIInteractive.prototype, "_transitions", void 0);
1060
1083
  __decorate([
1061
1084
  engine.ignoreClone
1062
1085
  ], UIInteractive.prototype, "_groupListener", null);
@@ -2906,9 +2929,9 @@
2906
2929
  Transition: Transition
2907
2930
  });
2908
2931
 
2909
- var uiDefaultFs = "#define GLSLIFY 1\n#include <common>\nuniform sampler2D renderer_UITexture;\n\nvarying vec2 v_uv;\nvarying vec4 v_color;\n\nvoid main() {\n vec4 baseColor = texture2DSRGB(renderer_UITexture, v_uv);\n vec4 finalColor = baseColor * v_color;\n #ifdef ENGINE_SHOULD_SRGB_CORRECT\n finalColor = outputSRGBCorrection(finalColor);\n #endif\n gl_FragColor = finalColor;\n}"; // eslint-disable-line
2932
+ var uiDefaultFs = "#include <common>\nuniform sampler2D renderer_UITexture;\n\nvarying vec2 v_uv;\nvarying vec4 v_color;\n\nvoid main() {\n vec4 baseColor = texture2DSRGB(renderer_UITexture, v_uv);\n vec4 finalColor = baseColor * v_color;\n #ifdef ENGINE_SHOULD_SRGB_CORRECT\n finalColor = outputSRGBCorrection(finalColor);\n #endif\n gl_FragColor = finalColor;\n}"; // eslint-disable-line
2910
2933
 
2911
- var uiDefaultVs = "#define GLSLIFY 1\nuniform mat4 renderer_MVPMat;\n\nattribute vec3 POSITION;\nattribute vec2 TEXCOORD_0;\nattribute vec4 COLOR_0;\n\nvarying vec2 v_uv;\nvarying vec4 v_color;\n\nvoid main() {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n\n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n}\n"; // eslint-disable-line
2934
+ var uiDefaultVs = "uniform mat4 renderer_MVPMat;\n\nattribute vec3 POSITION;\nattribute vec2 TEXCOORD_0;\nattribute vec4 COLOR_0;\n\nvarying vec2 v_uv;\nvarying vec4 v_color;\n\nvoid main() {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n\n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n}\n"; // eslint-disable-line
2912
2935
 
2913
2936
  /**
2914
2937
  * @internal