Commit efed272f authored by rockyl's avatar rockyl

更新tiny-image库

parent c1a8fe24
...@@ -2,10 +2,10 @@ var __extends;var __assign;var __rest;var __decorate;var __param;var __metadata; ...@@ -2,10 +2,10 @@ var __extends;var __assign;var __rest;var __decorate;var __param;var __metadata;
}};__exportStar=function(m,exports){for(var p in m){if(!exports.hasOwnProperty(p)){exports[p]=m[p]}}};__values=function(o){var m=typeof Symbol==="function"&&o[Symbol.iterator],i=0;if(m){return m.call(o)}return{next:function(){if(o&&i>=o.length){o=void 0}return{value:o&&o[i++],done:!o}}}};__read=function(o,n){var m=typeof Symbol==="function"&&o[Symbol.iterator];if(!m){return o}var i=m.call(o),r,ar=[],e;try{while((n===void 0||n-->0)&&!(r=i.next()).done){ar.push(r.value)}}catch(error){e={error:error}}finally{try{if(r&&!r.done&&(m=i["return"])){m.call(i)}}finally{if(e){throw e.error}}}return ar};__spread=function(){for(var ar=[],i=0;i<arguments.length;i++){ar=ar.concat(__read(arguments[i]))}return ar};__spreadArrays=function(){for(var s=0,i=0,il=arguments.length;i<il;i++){s+=arguments[i].length}for(var r=Array(s),k=0,i=0;i<il;i++){for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++){r[k]=a[j]}}return r};__await=function(v){return this instanceof __await?(this.v=v,this):new __await(v)};__asyncGenerator=function(thisArg,_arguments,generator){if(!Symbol.asyncIterator){throw new TypeError("Symbol.asyncIterator is not defined.")}var g=generator.apply(thisArg,_arguments||[]),i,q=[];return i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i;function verb(n){if(g[n]){i[n]=function(v){return new Promise(function(a,b){q.push([n,v,a,b])>1||resume(n,v)})}}}function resume(n,v){try{step(g[n](v))}catch(e){settle(q[0][3],e)}}function step(r){r.value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){if(f(v),q.shift(),q.length){resume(q[0][0],q[0][1])}}};__asyncDelegator=function(o){var i,p;return i={},verb("next"),verb("throw",function(e){throw e}),verb("return"),i[Symbol.iterator]=function(){return this},i;function verb(n,f){i[n]=o[n]?function(v){return(p=!p)?{value:__await(o[n](v)),done:n==="return"}:f?f(v):v}:f}};__asyncValues=function(o){if(!Symbol.asyncIterator){throw new TypeError("Symbol.asyncIterator is not defined.")}var m=o[Symbol.asyncIterator],i;return m?m.call(o):(o=typeof __values==="function"?__values(o):o[Symbol.iterator](),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);function verb(n){i[n]=o[n]&&function(v){return new Promise(function(resolve,reject){v=o[n](v),settle(resolve,reject,v.done,v.value)})}}function settle(resolve,reject,d,v){Promise.resolve(v).then(function(v){resolve({value:v,done:d})},reject)}};__makeTemplateObject=function(cooked,raw){if(Object.defineProperty){Object.defineProperty(cooked,"raw",{value:raw})}else{cooked.raw=raw}return cooked};__importStar=function(mod){if(mod&&mod.__esModule){return mod}var result={};if(mod!=null){for(var k in mod){if(Object.hasOwnProperty.call(mod,k)){result[k]=mod[k]}}}result["default"]=mod;return result};__importDefault=function(mod){return(mod&&mod.__esModule)?mod:{"default":mod}};exporter("__extends",__extends);exporter("__assign",__assign);exporter("__rest",__rest);exporter("__decorate",__decorate);exporter("__param",__param);exporter("__metadata",__metadata);exporter("__awaiter",__awaiter);exporter("__generator",__generator);exporter("__exportStar",__exportStar);exporter("__values",__values);exporter("__read",__read);exporter("__spread",__spread);exporter("__spreadArrays",__spreadArrays);exporter("__await",__await);exporter("__asyncGenerator",__asyncGenerator);exporter("__asyncDelegator",__asyncDelegator);exporter("__asyncValues",__asyncValues);exporter("__makeTemplateObject",__makeTemplateObject);exporter("__importStar",__importStar);exporter("__importDefault",__importDefault)}); }};__exportStar=function(m,exports){for(var p in m){if(!exports.hasOwnProperty(p)){exports[p]=m[p]}}};__values=function(o){var m=typeof Symbol==="function"&&o[Symbol.iterator],i=0;if(m){return m.call(o)}return{next:function(){if(o&&i>=o.length){o=void 0}return{value:o&&o[i++],done:!o}}}};__read=function(o,n){var m=typeof Symbol==="function"&&o[Symbol.iterator];if(!m){return o}var i=m.call(o),r,ar=[],e;try{while((n===void 0||n-->0)&&!(r=i.next()).done){ar.push(r.value)}}catch(error){e={error:error}}finally{try{if(r&&!r.done&&(m=i["return"])){m.call(i)}}finally{if(e){throw e.error}}}return ar};__spread=function(){for(var ar=[],i=0;i<arguments.length;i++){ar=ar.concat(__read(arguments[i]))}return ar};__spreadArrays=function(){for(var s=0,i=0,il=arguments.length;i<il;i++){s+=arguments[i].length}for(var r=Array(s),k=0,i=0;i<il;i++){for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++){r[k]=a[j]}}return r};__await=function(v){return this instanceof __await?(this.v=v,this):new __await(v)};__asyncGenerator=function(thisArg,_arguments,generator){if(!Symbol.asyncIterator){throw new TypeError("Symbol.asyncIterator is not defined.")}var g=generator.apply(thisArg,_arguments||[]),i,q=[];return i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i;function verb(n){if(g[n]){i[n]=function(v){return new Promise(function(a,b){q.push([n,v,a,b])>1||resume(n,v)})}}}function resume(n,v){try{step(g[n](v))}catch(e){settle(q[0][3],e)}}function step(r){r.value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){if(f(v),q.shift(),q.length){resume(q[0][0],q[0][1])}}};__asyncDelegator=function(o){var i,p;return i={},verb("next"),verb("throw",function(e){throw e}),verb("return"),i[Symbol.iterator]=function(){return this},i;function verb(n,f){i[n]=o[n]?function(v){return(p=!p)?{value:__await(o[n](v)),done:n==="return"}:f?f(v):v}:f}};__asyncValues=function(o){if(!Symbol.asyncIterator){throw new TypeError("Symbol.asyncIterator is not defined.")}var m=o[Symbol.asyncIterator],i;return m?m.call(o):(o=typeof __values==="function"?__values(o):o[Symbol.iterator](),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);function verb(n){i[n]=o[n]&&function(v){return new Promise(function(resolve,reject){v=o[n](v),settle(resolve,reject,v.done,v.value)})}}function settle(resolve,reject,d,v){Promise.resolve(v).then(function(v){resolve({value:v,done:d})},reject)}};__makeTemplateObject=function(cooked,raw){if(Object.defineProperty){Object.defineProperty(cooked,"raw",{value:raw})}else{cooked.raw=raw}return cooked};__importStar=function(mod){if(mod&&mod.__esModule){return mod}var result={};if(mod!=null){for(var k in mod){if(Object.hasOwnProperty.call(mod,k)){result[k]=mod[k]}}}result["default"]=mod;return result};__importDefault=function(mod){return(mod&&mod.__esModule)?mod:{"default":mod}};exporter("__extends",__extends);exporter("__assign",__assign);exporter("__rest",__rest);exporter("__decorate",__decorate);exporter("__param",__param);exporter("__metadata",__metadata);exporter("__awaiter",__awaiter);exporter("__generator",__generator);exporter("__exportStar",__exportStar);exporter("__values",__values);exporter("__read",__read);exporter("__spread",__spread);exporter("__spreadArrays",__spreadArrays);exporter("__await",__await);exporter("__asyncGenerator",__asyncGenerator);exporter("__asyncDelegator",__asyncDelegator);exporter("__asyncValues",__asyncValues);exporter("__makeTemplateObject",__makeTemplateObject);exporter("__importStar",__importStar);exporter("__importDefault",__importDefault)});
var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: __decorate,__param: __param,__metadata: __metadata,__awaiter: __awaiter,__generator: __generator,__exportStar: __exportStar,__values: __values,__read: __read,__spread: __spread,__spreadArrays: __spreadArrays,__await: __await,__asyncGenerator: __asyncGenerator,__asyncDelegator: __asyncDelegator,__asyncValues: __asyncValues,__makeTemplateObject: __makeTemplateObject,__importStar: __importStar,__importDefault: __importDefault}; var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: __decorate,__param: __param,__metadata: __metadata,__awaiter: __awaiter,__generator: __generator,__exportStar: __exportStar,__values: __values,__read: __read,__spread: __spread,__spreadArrays: __spreadArrays,__await: __await,__asyncGenerator: __asyncGenerator,__asyncDelegator: __asyncDelegator,__asyncValues: __asyncValues,__makeTemplateObject: __makeTemplateObject,__importStar: __importStar,__importDefault: __importDefault};
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib')) : typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('props-compute')) :
typeof define === 'function' && define.amd ? define(['exports', 'tslib'], factory) : typeof define === 'function' && define.amd ? define(['exports', 'tslib', 'props-compute'], factory) :
(global = global || self, factory(global.engine = {}, global.tslib)); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.engine = {}, global.tslib, global.propsCompute));
}(this, function (exports, tslib_1) { 'use strict'; }(this, (function (exports, tslib_1, propsCompute) { 'use strict';
var HashObject = (function () { var HashObject = (function () {
function HashObject() { function HashObject() {
...@@ -1413,6 +1413,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -1413,6 +1413,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}); });
Object.defineProperty(DisplayObject.prototype, "scale", { Object.defineProperty(DisplayObject.prototype, "scale", {
get: function () { get: function () {
if (this.destroyed) {
return 1;
}
return this.transform.scale; return this.transform.scale;
}, },
set: function (value) { set: function (value) {
...@@ -1934,13 +1937,20 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -1934,13 +1937,20 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var _this = this; var _this = this;
var list = this.alignList; var list = this.alignList;
list.forEach(function (v) { list.forEach(function (v) {
if (v.destroyed) {
return;
}
_this.autoSize(v); _this.autoSize(v);
_this.align(v); _this.align(v);
}); });
list.forEach(function (v) { list.forEach(function (v) {
if (v.destroyed) {
return;
}
if (v.alignMode === ALIGN_MODE.ONCE) { if (v.alignMode === ALIGN_MODE.ONCE) {
v.alignEnabled = false; v.alignEnabled = false;
} }
v.onLayoutComplete && v.onLayoutComplete();
}); });
list.length = 0; list.length = 0;
}; };
...@@ -3257,11 +3267,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -3257,11 +3267,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}; };
Container.prototype.attachVisibility = function () { Container.prototype.attachVisibility = function () {
return; return;
this.dispatchEvent(this.worldVisible ? Event.VISIBLE : Event.HIDDEN);
for (var i = 0, li = this.children.length; i < li; i++) {
var child = this.children[i];
child.attachVisibility();
}
}; };
Container.prototype.addChild = function (child) { Container.prototype.addChild = function (child) {
this.addChildAt(child, this.children.length); this.addChildAt(child, this.children.length);
...@@ -3831,11 +3836,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -3831,11 +3836,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
_this._transformID = -1; _this._transformID = -1;
return _this; return _this;
} }
FloatDisplay.prototype.addHtmlElement = function () { FloatDisplay.prototype.addHtmlElement = function (el) {
var s = this; var s = this;
if (!s.stage) {
return;
}
if (!container) { if (!container) {
container = document.createElement('div'); container = document.createElement('div');
container.style.position = "absolute"; container.style.position = "absolute";
...@@ -3846,16 +3848,24 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -3846,16 +3848,24 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
s.stage.rootDiv.appendChild(container); s.stage.rootDiv.appendChild(container);
} }
if (s._htmlElement) { if (s._htmlElement) {
var style = s._htmlElement.style; try {
if (!s._isAdded) { container.removeChild(s._htmlElement);
s._isAdded = true;
container.appendChild(s._htmlElement);
s.stage["_floatDisplayList"].push(s);
} }
else { catch (e) {
if (s._htmlElement && s.visible) { }
style.display = "block"; }
} if (el) {
s._htmlElement = el;
}
container.appendChild(s._htmlElement);
if (!s._isAdded) {
s._isAdded = true;
s.stage["_floatDisplayList"].push(s);
}
else {
if (s._htmlElement && s.visible) {
var style = s._htmlElement.style;
style.display = "block";
} }
} }
}; };
...@@ -3864,6 +3874,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -3864,6 +3874,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return this._htmlElement; return this._htmlElement;
}, },
set: function (v) { set: function (v) {
this._shouldUpdateStyle = true;
this.init(v); this.init(v);
this.updateStyle(); this.updateStyle();
}, },
...@@ -3904,8 +3915,11 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -3904,8 +3915,11 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
} }
s._localBoundsSelf.width = w; s._localBoundsSelf.width = w;
s._localBoundsSelf.height = h; s._localBoundsSelf.height = h;
s._htmlElement = she; if (!s.stage) {
this.addHtmlElement(); s._htmlElement = she;
return;
}
this.addHtmlElement(she);
}; };
FloatDisplay.prototype.getStyle = function (elem, cssName) { FloatDisplay.prototype.getStyle = function (elem, cssName) {
if (elem.style[cssName]) { if (elem.style[cssName]) {
...@@ -3943,7 +3957,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -3943,7 +3957,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
style.display = show; style.display = show;
} }
if (visible) { if (visible) {
if (this._transformID != this.transform._worldID) { if (this._shouldUpdateStyle || this._transformID != this.transform._worldID) {
this._shouldUpdateStyle = false;
this._transformID = this.transform._worldID; this._transformID = this.transform._worldID;
var mtx = s.transform.worldMatrix; var mtx = s.transform.worldMatrix;
var d = devicePixelRatio; var d = devicePixelRatio;
...@@ -4870,7 +4885,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -4870,7 +4885,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
} }
function determineCrossOrigin(url, loc) { function determineCrossOrigin(url, loc) {
if (loc === void 0) { loc = window.location; }
if (url.indexOf('data:') === 0) { if (url.indexOf('data:') === 0) {
return ''; return '';
} }
...@@ -5600,7 +5614,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -5600,7 +5614,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return color; return color;
} }
function inputFeildIosEnable() { function inputFeildIosEnable() {
var u = navigator.userAgent, app = navigator.appVersion; var u = navigator.userAgent;
var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
if (isIOS) { if (isIOS) {
setTimeout(function () { setTimeout(function () {
...@@ -16011,1052 +16025,1060 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -16011,1052 +16025,1060 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return EditableText; return EditableText;
}(TextField)); }(TextField));
var ScrollViewBase = (function (_super) { var Tween = (function () {
tslib_1.__extends(ScrollViewBase, _super); function Tween(target, props, pluginData) {
function ScrollViewBase(maxDistance, isFull) { this._target = null;
if (isFull === void 0) { isFull = false; } this._useTicks = false;
var _this = _super.call(this) || this; this.ignoreGlobalPause = false;
_this.distance = 0; this.loop = false;
_this.minDis = 0; this.pluginData = null;
_this.maskObj = new Graphics(); this._steps = null;
_this.viewPort = new Container(); this.paused = false;
_this.lastValue = 0; this.duration = 0;
_this.speed = 0; this._prevPos = -1;
_this.addSpeed = 0; this.position = null;
_this.isStop = true; this._prevPosition = 0;
_this.maxSpeed = 100; this._stepPosition = 0;
_this.fSpeed = 20; this.passive = false;
_this.paramXY = "y"; this.initialize(target, props, pluginData);
_this.paramSize = "height"; }
_this.stopTimes = -1; Tween.get = function (target, props, pluginData, override) {
_this.isMouseDownState = 0; if (pluginData === void 0) { pluginData = null; }
_this.autoScroll = false; if (override === void 0) { override = false; }
_this.isSpringBack = true; if (override) {
var s = _this; Tween.removeTweens(target);
s._instanceType = "ScrollContainer";
_super.prototype.addChild.call(_this, s.maskObj);
_super.prototype.addChild.call(_this, s.viewPort);
if (!isFull) {
s.viewPort.mask = s.maskObj;
s.maskObj.isUsedToMask = false;
} }
s.maskObj.alpha = 0; return new Tween(target, props, pluginData);
s.updateViewRect(); };
s.direction = exports.SCROLL_DIRECTION.VERTICAL; Tween.removeTweens = function (target) {
s.addEventListener(Event.ADDED_TO_STAGE, function (e) { if (!target.tween_count) {
s.stage.addEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s); return;
s.stage.addEventListener(MouseEvent.MOUSE_MOVE, s.onMouseEvent, s); }
}); var tweens = Tween._tweens;
s.addEventListener(Event.REMOVED_FROM_STAGE, function (e) { for (var i = tweens.length - 1; i >= 0; i--) {
s.stage.removeEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s); if (tweens[i]._target == target) {
s.stage.removeEventListener(MouseEvent.MOUSE_MOVE, s.onMouseEvent, s); tweens[i].paused = true;
}); tweens.splice(i, 1);
s.addEventListener(MouseEvent.MOUSE_DOWN, s.onMouseEvent, s, false);
s.addEventListener(Event.ENTER_FRAME, function () {
var view = s.viewPort;
if (s.autoScroll)
return;
if (!s.isSpringBack) {
if (view[s.paramXY] > 0) {
s.addSpeed = 0;
s.speed = 0;
s.isStop = true;
view[s.paramXY] = 0;
return;
}
else if (view[s.paramXY] < s.distance - s.maxDistance) {
s.addSpeed = 0;
s.speed = 0;
s.isStop = true;
view[s.paramXY] = Math.min(0, s.distance - s.maxDistance);
return;
}
}
if (!s.isStop) {
if (Math.abs(s.speed) > 0) {
view[s.paramXY] += s.speed;
if (view[s.paramXY] > 0 || view[s.paramXY] < s.distance - s.maxDistance) {
s.speed += s.addSpeed * s.fSpeed;
}
else {
s.speed += s.addSpeed;
}
if (s.speed * s.addSpeed > 0) {
s.dispatchEvent(Event.ON_SCROLL_STOP);
s.speed = 0;
}
}
else {
if (s.addSpeed != 0) {
if (view[s.paramXY] > 0 || view[s.paramXY] < s.distance - s.maxDistance) {
var tarP = 0;
if (view[s.paramXY] < s.distance - s.maxDistance) {
if (s.distance < s.maxDistance) {
tarP = s.distance - s.maxDistance;
}
}
view[s.paramXY] += 0.4 * (tarP - view[s.paramXY]);
if (Math.abs(tarP - view[s.paramXY]) < 0.1) {
s.isStop = true;
if (s.addSpeed > 0) {
s.dispatchEvent(Event.ON_SCROLL_TO_END);
}
else {
s.dispatchEvent(Event.ON_SCROLL_TO_HEAD);
}
}
}
}
else {
s.isStop = true;
}
}
} }
else { }
if (s.stopTimes >= 0) { target.tween_count = 0;
if (s.stopTimes >= 15) { };
s.speed = 0; Tween.pauseTweens = function (target) {
if (view[s.paramXY] > 0 || view[s.paramXY] < s.distance - s.maxDistance) { if (!target.tween_count) {
s.isStop = false; return;
s.stopTimes = -1; }
} var tweens = Tween._tweens;
} for (var i = tweens.length - 1; i >= 0; i--) {
} if (tweens[i]._target == target) {
tweens[i].paused = true;
} }
}); }
s.addEventListener(Event.RESIZE, _this.updateViewRect, s);
return _this;
}
Object.defineProperty(ScrollViewBase.prototype, "maxDistance", {
get: function () {
return this.calMaxDistance();
},
enumerable: true,
configurable: true
});
ScrollViewBase.prototype.calMaxDistance = function () {
return this.viewPort[this.paramSize] + this.viewPort.getLocalBounds()[this.paramXY];
}; };
Object.defineProperty(ScrollViewBase.prototype, "direction", { Tween.resumeTweens = function (target) {
get: function () { if (!target.tween_count) {
return this._direction; return;
},
set: function (value) {
this._direction = value;
this.updateDirection();
},
enumerable: true,
configurable: true
});
ScrollViewBase.prototype.updateDirection = function () {
var s = this;
if (this._direction === exports.SCROLL_DIRECTION.VERTICAL) {
s.distance = s.height;
s.paramXY = "y";
s.paramSize = 'height';
} }
else { var tweens = Tween._tweens;
s.distance = s.width; for (var i = tweens.length - 1; i >= 0; i--) {
s.paramXY = "x"; if (tweens[i]._target == target) {
s.paramSize = 'width'; tweens[i].paused = false;
}
} }
}; };
ScrollViewBase.prototype.updateViewRect = function () { Tween.tick = function (timeStamp, paused) {
var s = this; if (paused === void 0) { paused = false; }
s.maskObj.clear(); var delta = timeStamp - Tween._lastTime;
s.maskObj.beginFill("#000000"); Tween._lastTime = timeStamp;
s.maskObj.drawRect(0, 0, s.width, s.height); var tweens = Tween._tweens.concat();
s.maskObj.endFill(); for (var i = tweens.length - 1; i >= 0; i--) {
this.updateDirection(); var tween = tweens[i];
if ((paused && !tween.ignoreGlobalPause) || tween.paused) {
continue;
}
tween.$tick(tween._useTicks ? 1 : delta);
}
return false;
}; };
ScrollViewBase.prototype.cancelScroll = function () { Tween.flush = function () {
this.isMouseDownState = 0; var timeStamp = Date.now();
var delta = Tween._lastTime ? (timeStamp - Tween._lastTime) : 16.67;
Tween._lastTime = timeStamp;
var tweens = Tween._tweens.concat();
for (var i = tweens.length - 1; i >= 0; i--) {
var tween = tweens[i];
if (tween.paused) {
continue;
}
tween.$tick(tween._useTicks ? 1 : delta);
}
}; };
ScrollViewBase.prototype.onMouseEvent = function (e) { Tween._register = function (tween, value) {
var s = this; var target = tween._target;
var view = s.viewPort; var tweens = Tween._tweens;
if (e.type == MouseEvent.MOUSE_DOWN) { if (value) {
e.stopPropagation(); if (target) {
if (!s.isStop) { target.tween_count = target.tween_count > 0 ? target.tween_count + 1 : 1;
s.isStop = true;
} }
if (s.autoScroll) { tweens.push(tween);
s.autoScroll = false; if (!Tween._inited) {
Tween._inited = true;
} }
if (s._direction === exports.SCROLL_DIRECTION.VERTICAL) { }
s.lastValue = e.stageY; else {
if (target) {
target.tween_count--;
} }
else { var i = tweens.length;
s.lastValue = e.stageX; while (i--) {
if (tweens[i] == tween) {
tweens.splice(i, 1);
return;
}
} }
s.speed = 0;
s.isMouseDownState = 1;
} }
else if (e.type == MouseEvent.MOUSE_MOVE) { };
if (s.isMouseDownState == 0) Tween.removeAllTweens = function () {
return; var tweens = Tween._tweens;
if (s.isMouseDownState == 1) { for (var i = 0, l = tweens.length; i < l; i++) {
s.dispatchEvent(Event.ON_SCROLL_START); var tween = tweens[i];
} tween.paused = true;
s.isMouseDownState = 2; tween._target.tween_count = 0;
var currentValue = void 0; }
if (s._direction === exports.SCROLL_DIRECTION.VERTICAL) { tweens.length = 0;
currentValue = e.stageY; };
Tween.prototype.initialize = function (target, props, pluginData) {
this._target = target;
if (props) {
this._useTicks = props.useTicks;
this.ignoreGlobalPause = props.ignoreGlobalPause;
this.loop = props.loop;
if (props.onChange) {
this.onChange = props.onChange.bind(props.onChangeObj);
} }
else { else {
currentValue = e.stageX; this.onChange = null;
} }
s.speed = currentValue - s.lastValue; if (props.override) {
if (s.speed > s.minDis) { Tween.removeTweens(target);
s.addSpeed = -2;
if (s.speed > s.maxSpeed) {
s.speed = s.maxSpeed;
}
} }
else if (s.speed < -s.minDis) { }
if (s.speed < -s.maxSpeed) { this.pluginData = pluginData || {};
s.speed = -s.maxSpeed; this._curQueueProps = {};
this._initQueueProps = {};
this._steps = [];
if (props && props.paused) {
this.paused = true;
}
else {
Tween._register(this, true);
}
if (props && props.position != null) {
this.setPosition(props.position, Tween.NONE);
}
};
Tween.prototype.setPosition = function (value, actionsMode) {
if (actionsMode === void 0) { actionsMode = 1; }
if (value < 0) {
value = 0;
}
var t = value;
var end = false;
if (t >= this.duration) {
if (this.loop) {
var newTime = t % this.duration;
if (t > 0 && newTime === 0) {
t = this.duration;
}
else {
t = newTime;
} }
s.addSpeed = 2;
} }
else { else {
s.speed = 0; t = this.duration;
end = true;
} }
if (s.speed != 0) { }
var speedPer = 1; if (t == this._prevPos) {
if (view[s.paramXY] > 0 || view[s.paramXY] < s.distance - s.maxDistance) { return end;
speedPer = 0.2; }
if (end) {
this.setPaused(true);
}
var prevPos = this._prevPos;
this.position = this._prevPos = t;
this._prevPosition = value;
if (this._target) {
if (this._steps.length > 0) {
var l = this._steps.length;
var stepIndex = -1;
for (var i = 0; i < l; i++) {
if (this._steps[i].type == "step") {
stepIndex = i;
if (this._steps[i].t <= t && this._steps[i].t + this._steps[i].d >= t) {
break;
}
}
}
for (var i = 0; i < l; i++) {
if (this._steps[i].type == "action") {
if (actionsMode != 0) {
if (this._useTicks) {
this._runAction(this._steps[i], t, t);
}
else if (actionsMode == 1 && t < prevPos) {
if (prevPos != this.duration) {
this._runAction(this._steps[i], prevPos, this.duration);
}
this._runAction(this._steps[i], 0, t, true);
}
else {
this._runAction(this._steps[i], prevPos, t);
}
}
}
else if (this._steps[i].type == "step") {
if (stepIndex == i) {
var step = this._steps[stepIndex];
this._updateTargetProps(step, Math.min((this._stepPosition = t - step.t) / step.d, 1));
}
}
} }
view[s.paramXY] += (currentValue - s.lastValue) * speedPer;
} }
s.lastValue = currentValue; }
s.stopTimes = 0; this.onChange && this.onChange();
return end;
};
Tween.prototype._runAction = function (action, startPos, endPos, includeStart) {
if (includeStart === void 0) { includeStart = false; }
var sPos = startPos;
var ePos = endPos;
if (startPos > endPos) {
sPos = endPos;
ePos = startPos;
}
var pos = action.t;
if (pos == ePos || (pos > sPos && pos < ePos) || (includeStart && pos == startPos)) {
action.f.apply(action.o, action.p);
}
};
Tween.prototype._updateTargetProps = function (step, ratio) {
var p0, p1, v, v0, v1, arr;
if (!step && ratio == 1) {
this.passive = false;
p0 = p1 = this._curQueueProps;
} }
else { else {
s.isStop = false; this.passive = !!step.v;
s.stopTimes = -1; if (this.passive) {
if (s.speed == 0 && s.isMouseDownState == 2) { return;
s.dispatchEvent(Event.ON_SCROLL_STOP); }
if (step.e) {
ratio = step.e(ratio, 0, 1, 1);
}
p0 = step.p0;
p1 = step.p1;
}
for (var n in this._initQueueProps) {
if ((v0 = p0[n]) == null) {
p0[n] = v0 = this._initQueueProps[n];
}
if ((v1 = p1[n]) == null) {
p1[n] = v1 = v0;
}
if (v0 == v1 || ratio == 0 || ratio == 1 || (typeof (v0) != "number")) {
v = ratio == 1 ? v1 : v0;
}
else {
v = v0 + (v1 - v0) * ratio;
}
var ignore = false;
if (arr = Tween._plugins[n]) {
for (var i = 0, l = arr.length; i < l; i++) {
var v2 = arr[i].tween(this, n, v, p0, p1, ratio, !!step && p0 == p1, !step);
if (v2 == Tween.IGNORE) {
ignore = true;
}
else {
v = v2;
}
}
}
if (!ignore) {
this._target[n] = v;
} }
s.isMouseDownState = 0;
} }
}; };
ScrollViewBase.prototype.scrollTo = function (dis, time) { Tween.prototype.setPaused = function (value) {
var s = this; if (this.paused == value) {
var newDis = s.paramXY == "x" ? s.width : s.height; return this;
if (dis < 0) {
dis = 0;
} }
else if (dis > s.maxDistance - newDis) { this.paused = value;
dis = s.maxDistance - newDis; Tween._register(this, !value);
return this;
};
Tween.prototype._cloneProps = function (props) {
var o = {};
for (var n in props) {
o[n] = props[n];
} }
if (Math.abs(s.viewPort[s.paramXY] + dis) > 2) { return o;
s.isStop = true; };
s.isMouseDownState = 0; Tween.prototype._addStep = function (o) {
s.viewPort[s.paramXY] = -dis; if (o.d > 0) {
o.type = "step";
this._steps.push(o);
o.t = this.duration;
this.duration += o.d;
} }
return this;
}; };
ScrollViewBase.prototype.destroy = function () { Tween.prototype._appendQueueProps = function (o) {
var s = this; var arr, oldValue, i, l, injectProps;
s.maskObj.destroy(); for (var n in o) {
s.viewPort.destroy(); if (this._initQueueProps[n] === undefined) {
s.maskObj = null; oldValue = this._target[n];
s.viewPort = null; if (arr = Tween._plugins[n]) {
_super.prototype.destroy.call(this); for (i = 0, l = arr.length; i < l; i++) {
}; oldValue = arr[i].init(this, n, oldValue);
return ScrollViewBase; }
}(Container));
function fieldChanged(onModify) {
return function (target, key) {
var privateKey = '_' + key;
Object.defineProperty(target, key, {
enumerable: true,
get: function () {
return this[privateKey];
},
set: function (v) {
var oldValue = this[privateKey];
if (oldValue !== v) {
this[privateKey] = v;
onModify.apply(this, [v, key, oldValue]);
} }
this._initQueueProps[n] = this._curQueueProps[n] = (oldValue === undefined) ? null : oldValue;
} }
}); else {
oldValue = this._curQueueProps[n];
}
}
for (var n in o) {
oldValue = this._curQueueProps[n];
if (arr = Tween._plugins[n]) {
injectProps = injectProps || {};
for (i = 0, l = arr.length; i < l; i++) {
if (arr[i].step) {
arr[i].step(this, n, oldValue, o[n], injectProps);
}
}
}
this._curQueueProps[n] = o[n];
}
if (injectProps) {
this._appendQueueProps(injectProps);
}
return this._curQueueProps;
}; };
} Tween.prototype._addAction = function (o) {
var dirtyFieldDetector = fieldChanged(function (value, key, oldValue) { o.t = this.duration;
this['__fieldDirty'] = true; o.type = "action";
}); this._steps.push(o);
var deepDirtyFieldDetector = fieldChanged(function (value, key, oldValue) { return this;
var scope = this; };
scope['__fieldDirty'] = true; Tween.prototype._set = function (props, o) {
if (typeof value === 'object') { for (var n in props) {
value['onModify'] = function () { o[n] = props[n];
scope['__fieldDirty'] = true;
};
}
});
var dirtyFieldTrigger = fieldChanged(function (value, key, oldValue) {
this['onModify'] && this['onModify'](value, key, oldValue);
});
var deepDirtyFieldTrigger = fieldChanged(function (value, key, oldValue) {
if (this['onModify']) {
this['onModify'](value, key, oldValue);
if (typeof value === 'object') {
value['onModify'] = this['onModify'];
} }
} };
}); Tween.prototype.wait = function (duration, passive) {
if (duration == null || duration <= 0) {
var ScrollListItemBase = (function (_super) { return this;
tslib_1.__extends(ScrollListItemBase, _super);
function ScrollListItemBase() {
return _super !== null && _super.apply(this, arguments) || this;
}
ScrollListItemBase.prototype._initData = function (id, data) {
this.id = id;
this.data = data;
if (id >= 0) {
this.updateData(data);
} }
var o = this._cloneProps(this._curQueueProps);
return this._addStep({ d: duration, p0: o, p1: o, v: passive });
}; };
return ScrollListItemBase; Tween.prototype.to = function (props, duration, ease) {
}(Container)); if (ease === void 0) { ease = undefined; }
var ScrollListBase = (function (_super) { if (isNaN(duration) || duration < 0) {
tslib_1.__extends(ScrollListBase, _super); duration = 0;
function ScrollListBase() { }
var _this = _super.call(this) || this; this._addStep({ d: duration || 0, p0: this._cloneProps(this._curQueueProps), e: ease, p1: this._cloneProps(this._appendQueueProps(props)) });
_this._items = null; return this.set(props);
_this._isInit = 0;
_this.data = [];
_this.downL = null;
_this._lastFirstId = -1;
_this._updateId = -1;
_this.itemWidth = 0;
_this.itemHeight = 0;
_this.cols = 1;
var s = _this;
s._instanceType = "ScrollList";
s._items = [];
s._itemCount = 0;
s.once(Event.ENTER_FRAME, s.onNextFrame, s);
s.addEventListener(Event.ENTER_FRAME, s.flushData.bind(s));
return _this;
}
Object.defineProperty(ScrollListBase.prototype, "loadingView", {
get: function () {
return this.downL;
},
enumerable: true,
configurable: true
});
ScrollListBase.prototype.onNextFrame = function (event) {
this.updateViewRect();
}; };
ScrollListBase.prototype.onModify = function (value, key) { Tween.prototype.call = function (callback, thisObj, params) {
if (thisObj === void 0) { thisObj = undefined; }
if (params === void 0) { params = undefined; }
return this._addAction({ f: callback, p: params ? params : [], o: thisObj ? thisObj : this._target });
}; };
ScrollListBase.prototype.calMaxDistance = function () { Tween.prototype.set = function (props, target) {
var key = 'item' + this.paramSize.substr(0, 1).toUpperCase() + this.paramSize.substr(1); if (target === void 0) { target = null; }
return this[key] * Math.ceil(this.data.length / this.cols); this._appendQueueProps(props);
return this._addAction({ f: this._set, o: this, p: [props, target ? target : this._target] });
}; };
ScrollListBase.prototype.updateData = function (data, isReset) { Tween.prototype.play = function (tween) {
if (isReset === void 0) { isReset = true; } if (!tween) {
var s = this; tween = this;
if (!s._isInit || isReset) {
s.data = data;
} }
else { return this.call(tween.setPaused, tween, [false]);
s.data = s.data.concat(data); };
Tween.prototype.pause = function (tween) {
if (!tween) {
tween = this;
} }
s._isInit = 1; return this.call(tween.setPaused, tween, [true]);
s._lastFirstId = -1;
}; };
ScrollListBase.prototype.flushData = function () { Tween.prototype.$tick = function (delta) {
var s = this; if (this.paused) {
var items = s._items;
if (items.length <= 0) {
return; return;
} }
if (s._isInit > 0) { this.setPosition(this._prevPosition + delta);
if (s._updateId != s.viewPort.transform._localID) {
var id = s.viewPort[s.paramXY] > 0 ? 0 : (Math.abs(Math.floor(s.viewPort[s.paramXY] / s._itemRow)) - 1) * s.cols;
id = id < 0 ? 0 : id;
if (id != s._lastFirstId) {
s._lastFirstId = id;
if (id != items[0].id) {
for (var r = 0; r < s.cols; r++) {
if (s.speed > 0) {
items.unshift(items.pop());
}
else {
items.push(items.shift());
}
}
}
}
for (var i = 0; i < s._itemCount; i++) {
var item = items[i];
if (s._isInit == 1) {
item.sli_id = -1;
}
if (item.sli_id != id) {
if (s.data[id]) {
item._initData(s.data[id] ? id : -1, s.data[id]);
}
item[s.paramXY] = Math.floor(id / s.cols) * s._itemRow;
item[s._disParam] = (id % s.cols) * s._itemCol;
if (s.data[id]) {
item.sli_id = id;
item.visible = true;
}
else {
item.sli_id = -1;
item.visible = false;
}
}
id++;
}
s._isInit = 2;
}
}
}; };
ScrollListBase.prototype.updateViewRect = function () { Tween.NONE = 0;
_super.prototype.updateViewRect.call(this); Tween.LOOP = 1;
var s = this; Tween.REVERSE = 2;
if (s.itemWidth && s.itemHeight) { Tween._tweens = [];
s._updateViewRect(); Tween.IGNORE = {};
Tween._plugins = {};
Tween._inited = false;
Tween._lastTime = 0;
return Tween;
}());
var Ease = (function () {
function Ease() {
}
Ease.get = function (amount) {
if (amount < -1) {
amount = -1;
} }
}; if (amount > 1) {
ScrollListBase.prototype._updateViewRect = function () { amount = 1;
var s = this;
if (s._direction === exports.SCROLL_DIRECTION.VERTICAL) {
if (s.itemHeight <= 0) {
return;
}
s._disParam = "x";
s._itemRow = s.itemHeight;
s._itemCol = s.itemWidth;
} }
else { return function (t) {
if (s.itemWidth <= 0) { if (amount == 0) {
return; return t;
}
s._disParam = "y";
s._itemRow = s.itemWidth;
s._itemCol = s.itemHeight;
}
var newCount = (Math.ceil(s.distance / s._itemRow) + 1) * s.cols;
if (newCount != s._itemCount) {
if (newCount > s._itemCount) {
for (var i = s._itemCount; i < newCount; i++) {
var item = s.createItem();
item.id = -1;
item.data = null;
s._items.push(item);
s.viewPort.addChild(item);
}
} }
else { if (amount < 0) {
for (var i = 0; i < s._itemCount - newCount; i++) { return t * (t * -amount + 1 + amount);
s.viewPort.removeChild(s._items.pop());
}
} }
s._itemCount = newCount; return t * ((2 - t) * amount + (1 - amount));
s._lastFirstId = -1; };
}
}; };
ScrollListBase.prototype.createItem = function () { Ease.getPowIn = function (pow) {
return new this.itemClass(); return function (t) {
return Math.pow(t, pow);
};
}; };
ScrollListBase.prototype.setLoading = function (downLoading) { Ease.getPowOut = function (pow) {
var s = this; return function (t) {
if (s.downL) { return 1 - Math.pow(1 - t, pow);
s.viewPort.removeChild(s.downL); };
s.downL = null;
}
if (downLoading) {
s.downL = downLoading;
s.viewPort.addChild(downLoading);
s.downL[s.paramXY] = Math.max(s.distance, s.maxDistance);
}
else {
s.isStop = false;
}
}; };
ScrollListBase.prototype.destroy = function () { Ease.getPowInOut = function (pow) {
var s = this; return function (t) {
s._items = null; if ((t *= 2) < 1)
s.itemClass = null; return 0.5 * Math.pow(t, pow);
s.data = null; return 1 - 0.5 * Math.abs(Math.pow(2 - t, pow));
s.downL = null; };
_super.prototype.destroy.call(this);
}; };
tslib_1.__decorate([ Ease.sineIn = function (t) {
dirtyFieldTrigger return 1 - Math.cos(t * Math.PI / 2);
], ScrollListBase.prototype, "itemWidth", void 0);
tslib_1.__decorate([
dirtyFieldTrigger
], ScrollListBase.prototype, "itemHeight", void 0);
tslib_1.__decorate([
dirtyFieldTrigger
], ScrollListBase.prototype, "cols", void 0);
tslib_1.__decorate([
dirtyFieldTrigger
], ScrollListBase.prototype, "itemClass", void 0);
return ScrollListBase;
}(ScrollViewBase));
var Tween = (function () {
function Tween(target, props, pluginData) {
this._target = null;
this._useTicks = false;
this.ignoreGlobalPause = false;
this.loop = false;
this.pluginData = null;
this._steps = null;
this.paused = false;
this.duration = 0;
this._prevPos = -1;
this.position = null;
this._prevPosition = 0;
this._stepPosition = 0;
this.passive = false;
this.initialize(target, props, pluginData);
}
Tween.get = function (target, props, pluginData, override) {
if (pluginData === void 0) { pluginData = null; }
if (override === void 0) { override = false; }
if (override) {
Tween.removeTweens(target);
}
return new Tween(target, props, pluginData);
}; };
Tween.removeTweens = function (target) { Ease.sineOut = function (t) {
if (!target.tween_count) { return Math.sin(t * Math.PI / 2);
return;
}
var tweens = Tween._tweens;
for (var i = tweens.length - 1; i >= 0; i--) {
if (tweens[i]._target == target) {
tweens[i].paused = true;
tweens.splice(i, 1);
}
}
target.tween_count = 0;
}; };
Tween.pauseTweens = function (target) { Ease.sineInOut = function (t) {
if (!target.tween_count) { return -0.5 * (Math.cos(Math.PI * t) - 1);
return;
}
var tweens = Tween._tweens;
for (var i = tweens.length - 1; i >= 0; i--) {
if (tweens[i]._target == target) {
tweens[i].paused = true;
}
}
}; };
Tween.resumeTweens = function (target) { Ease.getBackIn = function (amount) {
if (!target.tween_count) { return function (t) {
return; return t * t * ((amount + 1) * t - amount);
} };
var tweens = Tween._tweens;
for (var i = tweens.length - 1; i >= 0; i--) {
if (tweens[i]._target == target) {
tweens[i].paused = false;
}
}
}; };
Tween.tick = function (timeStamp, paused) { Ease.getBackOut = function (amount) {
if (paused === void 0) { paused = false; } return function (t) {
var delta = timeStamp - Tween._lastTime; return (--t * t * ((amount + 1) * t + amount) + 1);
Tween._lastTime = timeStamp; };
var tweens = Tween._tweens.concat();
for (var i = tweens.length - 1; i >= 0; i--) {
var tween = tweens[i];
if ((paused && !tween.ignoreGlobalPause) || tween.paused) {
continue;
}
tween.$tick(tween._useTicks ? 1 : delta);
}
return false;
}; };
Tween.flush = function () { Ease.getBackInOut = function (amount) {
var timeStamp = Date.now(); amount *= 1.525;
var delta = Tween._lastTime ? (timeStamp - Tween._lastTime) : 16.67; return function (t) {
Tween._lastTime = timeStamp; if ((t *= 2) < 1)
var tweens = Tween._tweens.concat(); return 0.5 * (t * t * ((amount + 1) * t - amount));
for (var i = tweens.length - 1; i >= 0; i--) { return 0.5 * ((t -= 2) * t * ((amount + 1) * t + amount) + 2);
var tween = tweens[i]; };
if (tween.paused) {
continue;
}
tween.$tick(tween._useTicks ? 1 : delta);
}
}; };
Tween._register = function (tween, value) { Ease.circIn = function (t) {
var target = tween._target; return -(Math.sqrt(1 - t * t) - 1);
var tweens = Tween._tweens;
if (value) {
if (target) {
target.tween_count = target.tween_count > 0 ? target.tween_count + 1 : 1;
}
tweens.push(tween);
if (!Tween._inited) {
Tween._inited = true;
}
}
else {
if (target) {
target.tween_count--;
}
var i = tweens.length;
while (i--) {
if (tweens[i] == tween) {
tweens.splice(i, 1);
return;
}
}
}
}; };
Tween.removeAllTweens = function () { Ease.circOut = function (t) {
var tweens = Tween._tweens; return Math.sqrt(1 - (--t) * t);
for (var i = 0, l = tweens.length; i < l; i++) { };
var tween = tweens[i]; Ease.circInOut = function (t) {
tween.paused = true; if ((t *= 2) < 1) {
tween._target.tween_count = 0; return -0.5 * (Math.sqrt(1 - t * t) - 1);
} }
tweens.length = 0; return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
}; };
Tween.prototype.initialize = function (target, props, pluginData) { Ease.bounceIn = function (t) {
this._target = target; return 1 - Ease.bounceOut(1 - t);
if (props) { };
this._useTicks = props.useTicks; Ease.bounceOut = function (t) {
this.ignoreGlobalPause = props.ignoreGlobalPause; if (t < 1 / 2.75) {
this.loop = props.loop; return (7.5625 * t * t);
if (props.onChange) {
this.onChange = props.onChange.bind(props.onChangeObj);
}
else {
this.onChange = null;
}
if (props.override) {
Tween.removeTweens(target);
}
} }
this.pluginData = pluginData || {}; else if (t < 2 / 2.75) {
this._curQueueProps = {}; return (7.5625 * (t -= 1.5 / 2.75) * t + 0.75);
this._initQueueProps = {};
this._steps = [];
if (props && props.paused) {
this.paused = true;
} }
else { else if (t < 2.5 / 2.75) {
Tween._register(this, true); return (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375);
} }
if (props && props.position != null) { else {
this.setPosition(props.position, Tween.NONE); return (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375);
} }
}; };
Tween.prototype.setPosition = function (value, actionsMode) { Ease.bounceInOut = function (t) {
if (actionsMode === void 0) { actionsMode = 1; } if (t < 0.5)
if (value < 0) { return Ease.bounceIn(t * 2) * .5;
value = 0; return Ease.bounceOut(t * 2 - 1) * 0.5 + 0.5;
};
Ease.getElasticIn = function (amplitude, period) {
var pi2 = Math.PI * 2;
return function (t) {
if (t == 0 || t == 1)
return t;
var s = period / pi2 * Math.asin(1 / amplitude);
return -(amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period));
};
};
Ease.getElasticOut = function (amplitude, period) {
var pi2 = Math.PI * 2;
return function (t) {
if (t == 0 || t == 1)
return t;
var s = period / pi2 * Math.asin(1 / amplitude);
return (amplitude * Math.pow(2, -10 * t) * Math.sin((t - s) * pi2 / period) + 1);
};
};
Ease.getElasticInOut = function (amplitude, period) {
var pi2 = Math.PI * 2;
return function (t) {
var s = period / pi2 * Math.asin(1 / amplitude);
if ((t *= 2) < 1)
return -0.5 * (amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period));
return amplitude * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * pi2 / period) * 0.5 + 1;
};
};
Ease.quadIn = Ease.getPowIn(2);
Ease.quadOut = Ease.getPowOut(2);
Ease.quadInOut = Ease.getPowInOut(2);
Ease.cubicIn = Ease.getPowIn(3);
Ease.cubicOut = Ease.getPowOut(3);
Ease.cubicInOut = Ease.getPowInOut(3);
Ease.quartIn = Ease.getPowIn(4);
Ease.quartOut = Ease.getPowOut(4);
Ease.quartInOut = Ease.getPowInOut(4);
Ease.quintIn = Ease.getPowIn(5);
Ease.quintOut = Ease.getPowOut(5);
Ease.quintInOut = Ease.getPowInOut(5);
Ease.backIn = Ease.getBackIn(1.7);
Ease.backOut = Ease.getBackOut(1.7);
Ease.backInOut = Ease.getBackInOut(1.7);
Ease.elasticIn = Ease.getElasticIn(1, 0.3);
Ease.elasticOut = Ease.getElasticOut(1, 0.3);
Ease.elasticInOut = Ease.getElasticInOut(1, 0.3 * 1.5);
return Ease;
}());
var ScrollViewBase = (function (_super) {
tslib_1.__extends(ScrollViewBase, _super);
function ScrollViewBase(maxDistance, isFull) {
if (isFull === void 0) { isFull = false; }
var _this = _super.call(this) || this;
_this.distance = 0;
_this.minDis = 0;
_this.maskObj = new Graphics();
_this.viewPort = new Container();
_this.lastValue = 0;
_this.speed = 0;
_this.addSpeed = 0;
_this.isStop = true;
_this.maxSpeed = 100;
_this.fSpeed = 20;
_this.paramXY = "y";
_this.paramSize = "height";
_this.stopTimes = -1;
_this.isMouseDownState = 0;
_this.autoScroll = false;
_this.isSpringBack = true;
var s = _this;
s._instanceType = "ScrollContainer";
_super.prototype.addChild.call(_this, s.maskObj);
_super.prototype.addChild.call(_this, s.viewPort);
if (!isFull) {
s.viewPort.mask = s.maskObj;
s.maskObj.isUsedToMask = false;
} }
var t = value; s.maskObj.alpha = 0;
var end = false; s.updateViewRect();
if (t >= this.duration) { s.direction = exports.SCROLL_DIRECTION.VERTICAL;
if (this.loop) { s.addEventListener(Event.ADDED_TO_STAGE, function (e) {
var newTime = t % this.duration; s.stage.addEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s);
if (t > 0 && newTime === 0) { s.stage.addEventListener(MouseEvent.MOUSE_MOVE, s.onMouseEvent, s);
t = this.duration; });
s.addEventListener(Event.REMOVED_FROM_STAGE, function (e) {
s.stage.removeEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s);
s.stage.removeEventListener(MouseEvent.MOUSE_MOVE, s.onMouseEvent, s);
});
s.addEventListener(MouseEvent.MOUSE_DOWN, s.onMouseEvent, s, false);
s.addEventListener(Event.ENTER_FRAME, function () {
var view = s.viewPort;
if (s.autoScroll)
return;
if (!s.isSpringBack) {
if (view[s.paramXY] > 0) {
s.addSpeed = 0;
s.speed = 0;
s.isStop = true;
view[s.paramXY] = 0;
return;
} }
else { else if (view[s.paramXY] < s.distance - s.maxDistance) {
t = newTime; s.addSpeed = 0;
s.speed = 0;
s.isStop = true;
view[s.paramXY] = Math.min(0, s.distance - s.maxDistance);
return;
} }
} }
else { if (!s.isStop) {
t = this.duration; if (Math.abs(s.speed) > 0) {
end = true; view[s.paramXY] += s.speed;
} if (view[s.paramXY] > 0 || view[s.paramXY] < s.distance - s.maxDistance) {
} s.speed += s.addSpeed * s.fSpeed;
if (t == this._prevPos) { }
return end; else {
} s.speed += s.addSpeed;
if (end) { }
this.setPaused(true); if (s.speed * s.addSpeed > 0) {
} s.dispatchEvent(Event.ON_SCROLL_STOP);
var prevPos = this._prevPos; s.speed = 0;
this.position = this._prevPos = t;
this._prevPosition = value;
if (this._target) {
if (this._steps.length > 0) {
var l = this._steps.length;
var stepIndex = -1;
for (var i = 0; i < l; i++) {
if (this._steps[i].type == "step") {
stepIndex = i;
if (this._steps[i].t <= t && this._steps[i].t + this._steps[i].d >= t) {
break;
}
} }
} }
for (var i = 0; i < l; i++) { else {
if (this._steps[i].type == "action") { if (s.addSpeed != 0) {
if (actionsMode != 0) { if (view[s.paramXY] > 0 || view[s.paramXY] < s.distance - s.maxDistance) {
if (this._useTicks) { var tarP = 0;
this._runAction(this._steps[i], t, t); if (view[s.paramXY] < s.distance - s.maxDistance) {
} if (s.distance < s.maxDistance) {
else if (actionsMode == 1 && t < prevPos) { tarP = s.distance - s.maxDistance;
if (prevPos != this.duration) {
this._runAction(this._steps[i], prevPos, this.duration);
} }
this._runAction(this._steps[i], 0, t, true);
} }
else { view[s.paramXY] += 0.4 * (tarP - view[s.paramXY]);
this._runAction(this._steps[i], prevPos, t); if (Math.abs(tarP - view[s.paramXY]) < 0.1) {
s.isStop = true;
if (s.addSpeed > 0) {
s.dispatchEvent(Event.ON_SCROLL_TO_END);
}
else {
s.dispatchEvent(Event.ON_SCROLL_TO_HEAD);
}
} }
} }
} }
else if (this._steps[i].type == "step") { else {
if (stepIndex == i) { s.isStop = true;
var step = this._steps[stepIndex]; }
this._updateTargetProps(step, Math.min((this._stepPosition = t - step.t) / step.d, 1)); }
}
else {
if (s.stopTimes >= 0) {
if (s.stopTimes >= 15) {
s.speed = 0;
if (view[s.paramXY] > 0 || view[s.paramXY] < s.distance - s.maxDistance) {
s.isStop = false;
s.stopTimes = -1;
} }
} }
} }
} }
} });
this.onChange && this.onChange(); s.addEventListener(Event.RESIZE, _this.updateViewRect, s);
return end; return _this;
}
Object.defineProperty(ScrollViewBase.prototype, "maxDistance", {
get: function () {
return this.calMaxDistance();
},
enumerable: true,
configurable: true
});
ScrollViewBase.prototype.calMaxDistance = function () {
return this.viewPort[this.paramSize] + this.viewPort.getLocalBounds()[this.paramXY];
}; };
Tween.prototype._runAction = function (action, startPos, endPos, includeStart) { Object.defineProperty(ScrollViewBase.prototype, "direction", {
if (includeStart === void 0) { includeStart = false; } get: function () {
var sPos = startPos; return this._direction;
var ePos = endPos; },
if (startPos > endPos) { set: function (value) {
sPos = endPos; this._direction = value;
ePos = startPos; this.updateDirection();
},
enumerable: true,
configurable: true
});
ScrollViewBase.prototype.updateDirection = function () {
var s = this;
if (this._direction === exports.SCROLL_DIRECTION.VERTICAL) {
s.distance = s.height;
s.paramXY = "y";
s.paramSize = 'height';
} }
var pos = action.t; else {
if (pos == ePos || (pos > sPos && pos < ePos) || (includeStart && pos == startPos)) { s.distance = s.width;
action.f.apply(action.o, action.p); s.paramXY = "x";
s.paramSize = 'width';
} }
}; };
Tween.prototype._updateTargetProps = function (step, ratio) { ScrollViewBase.prototype.updateViewRect = function () {
var p0, p1, v, v0, v1, arr; var s = this;
if (!step && ratio == 1) { s.maskObj.clear();
this.passive = false; s.maskObj.beginFill("#000000");
p0 = p1 = this._curQueueProps; s.maskObj.drawRect(0, 0, s.width, s.height);
s.maskObj.endFill();
this.updateDirection();
};
ScrollViewBase.prototype.cancelScroll = function () {
this.isMouseDownState = 0;
};
ScrollViewBase.prototype.onMouseEvent = function (e) {
var s = this;
var view = s.viewPort;
if (e.type == MouseEvent.MOUSE_DOWN) {
e.stopPropagation();
if (!s.isStop) {
s.isStop = true;
}
if (s.autoScroll) {
s.autoScroll = false;
}
if (s._direction === exports.SCROLL_DIRECTION.VERTICAL) {
s.lastValue = e.stageY;
}
else {
s.lastValue = e.stageX;
}
s.speed = 0;
s.isMouseDownState = 1;
} }
else { else if (e.type == MouseEvent.MOUSE_MOVE) {
this.passive = !!step.v; if (s.isMouseDownState == 0)
if (this.passive) {
return; return;
if (s.isMouseDownState == 1) {
s.dispatchEvent(Event.ON_SCROLL_START);
} }
if (step.e) { s.isMouseDownState = 2;
ratio = step.e(ratio, 0, 1, 1); var currentValue = void 0;
if (s._direction === exports.SCROLL_DIRECTION.VERTICAL) {
currentValue = e.stageY;
} }
p0 = step.p0; else {
p1 = step.p1; currentValue = e.stageX;
}
for (var n in this._initQueueProps) {
if ((v0 = p0[n]) == null) {
p0[n] = v0 = this._initQueueProps[n];
} }
if ((v1 = p1[n]) == null) { s.speed = currentValue - s.lastValue;
p1[n] = v1 = v0; if (s.speed > s.minDis) {
s.addSpeed = -2;
if (s.speed > s.maxSpeed) {
s.speed = s.maxSpeed;
}
} }
if (v0 == v1 || ratio == 0 || ratio == 1 || (typeof (v0) != "number")) { else if (s.speed < -s.minDis) {
v = ratio == 1 ? v1 : v0; if (s.speed < -s.maxSpeed) {
s.speed = -s.maxSpeed;
}
s.addSpeed = 2;
} }
else { else {
v = v0 + (v1 - v0) * ratio; s.speed = 0;
} }
var ignore = false; if (s.speed != 0) {
if (arr = Tween._plugins[n]) { var speedPer = 1;
for (var i = 0, l = arr.length; i < l; i++) { if (view[s.paramXY] > 0 || view[s.paramXY] < s.distance - s.maxDistance) {
var v2 = arr[i].tween(this, n, v, p0, p1, ratio, !!step && p0 == p1, !step); speedPer = 0.2;
if (v2 == Tween.IGNORE) {
ignore = true;
}
else {
v = v2;
}
} }
view[s.paramXY] += (currentValue - s.lastValue) * speedPer;
} }
if (!ignore) { s.lastValue = currentValue;
this._target[n] = v; s.stopTimes = 0;
}
} }
}; else {
Tween.prototype.setPaused = function (value) { s.isStop = false;
if (this.paused == value) { s.stopTimes = -1;
return this; if (s.speed == 0 && s.isMouseDownState == 2) {
s.dispatchEvent(Event.ON_SCROLL_STOP);
}
s.isMouseDownState = 0;
} }
this.paused = value;
Tween._register(this, !value);
return this;
}; };
Tween.prototype._cloneProps = function (props) { ScrollViewBase.prototype.scrollTo = function (dis, time) {
var o = {}; if (time === void 0) { time = 0; }
for (var n in props) { var _a;
o[n] = props[n]; var s = this;
var newDis = s.paramXY == "x" ? s.width : s.height;
if (dis < 0) {
dis = 0;
} }
return o; else if (dis > s.maxDistance - newDis) {
}; dis = s.maxDistance - newDis;
Tween.prototype._addStep = function (o) {
if (o.d > 0) {
o.type = "step";
this._steps.push(o);
o.t = this.duration;
this.duration += o.d;
} }
return this; if (Math.abs(s.viewPort[s.paramXY] + dis) > 2) {
}; s.isStop = true;
Tween.prototype._appendQueueProps = function (o) { s.isMouseDownState = 0;
var arr, oldValue, i, l, injectProps; if (time > 0) {
for (var n in o) { Tween.get(s.viewPort, null, null, true)
if (this._initQueueProps[n] === undefined) { .to((_a = {}, _a[s.paramXY] = -dis, _a), time, Ease.cubicInOut);
oldValue = this._target[n];
if (arr = Tween._plugins[n]) {
for (i = 0, l = arr.length; i < l; i++) {
oldValue = arr[i].init(this, n, oldValue);
}
}
this._initQueueProps[n] = this._curQueueProps[n] = (oldValue === undefined) ? null : oldValue;
} }
else { else {
oldValue = this._curQueueProps[n]; s.viewPort[s.paramXY] = -dis;
} }
} }
for (var n in o) { };
oldValue = this._curQueueProps[n]; ScrollViewBase.prototype.destroy = function () {
if (arr = Tween._plugins[n]) { var s = this;
injectProps = injectProps || {}; s.maskObj.destroy();
for (i = 0, l = arr.length; i < l; i++) { s.viewPort.destroy();
if (arr[i].step) { s.maskObj = null;
arr[i].step(this, n, oldValue, o[n], injectProps); s.viewPort = null;
} _super.prototype.destroy.call(this);
};
return ScrollViewBase;
}(Container));
function fieldChanged(onModify) {
return function (target, key) {
var privateKey = '_' + key;
Object.defineProperty(target, key, {
enumerable: true,
get: function () {
return this[privateKey];
},
set: function (v) {
var oldValue = this[privateKey];
if (oldValue !== v) {
this[privateKey] = v;
onModify.apply(this, [v, key, oldValue]);
} }
} }
this._curQueueProps[n] = o[n]; });
}
if (injectProps) {
this._appendQueueProps(injectProps);
}
return this._curQueueProps;
};
Tween.prototype._addAction = function (o) {
o.t = this.duration;
o.type = "action";
this._steps.push(o);
return this;
}; };
Tween.prototype._set = function (props, o) { }
for (var n in props) { var dirtyFieldDetector = fieldChanged(function (value, key, oldValue) {
o[n] = props[n]; this['__fieldDirty'] = true;
});
var deepDirtyFieldDetector = fieldChanged(function (value, key, oldValue) {
var scope = this;
scope['__fieldDirty'] = true;
if (typeof value === 'object') {
value['onModify'] = function () {
scope['__fieldDirty'] = true;
};
}
});
var dirtyFieldTrigger = fieldChanged(function (value, key, oldValue) {
this['onModify'] && this['onModify'](value, key, oldValue);
});
var deepDirtyFieldTrigger = fieldChanged(function (value, key, oldValue) {
if (this['onModify']) {
this['onModify'](value, key, oldValue);
if (typeof value === 'object') {
value['onModify'] = this['onModify'];
} }
}; }
Tween.prototype.wait = function (duration, passive) { });
if (duration == null || duration <= 0) {
return this; var ScrollListItemBase = (function (_super) {
tslib_1.__extends(ScrollListItemBase, _super);
function ScrollListItemBase() {
return _super !== null && _super.apply(this, arguments) || this;
}
ScrollListItemBase.prototype._initData = function (id, data) {
this.id = id;
this.data = data;
if (id >= 0) {
this.updateData(data);
} }
var o = this._cloneProps(this._curQueueProps);
return this._addStep({ d: duration, p0: o, p1: o, v: passive });
}; };
Tween.prototype.to = function (props, duration, ease) { return ScrollListItemBase;
if (ease === void 0) { ease = undefined; } }(Container));
if (isNaN(duration) || duration < 0) { var ScrollListBase = (function (_super) {
duration = 0; tslib_1.__extends(ScrollListBase, _super);
} function ScrollListBase() {
this._addStep({ d: duration || 0, p0: this._cloneProps(this._curQueueProps), e: ease, p1: this._cloneProps(this._appendQueueProps(props)) }); var _this = _super.call(this) || this;
return this.set(props); _this._items = null;
_this._isInit = 0;
_this.data = [];
_this.downL = null;
_this._lastFirstId = -1;
_this._updateId = -1;
_this.itemWidth = 0;
_this.itemHeight = 0;
_this.cols = 1;
var s = _this;
s._instanceType = "ScrollList";
s._items = [];
s._itemCount = 0;
s.once(Event.ENTER_FRAME, s.onNextFrame, s);
s.addEventListener(Event.ENTER_FRAME, s.flushData.bind(s));
return _this;
}
Object.defineProperty(ScrollListBase.prototype, "loadingView", {
get: function () {
return this.downL;
},
enumerable: true,
configurable: true
});
ScrollListBase.prototype.onNextFrame = function (event) {
this.updateViewRect();
}; };
Tween.prototype.call = function (callback, thisObj, params) { ScrollListBase.prototype.onModify = function (value, key) {
if (thisObj === void 0) { thisObj = undefined; }
if (params === void 0) { params = undefined; }
return this._addAction({ f: callback, p: params ? params : [], o: thisObj ? thisObj : this._target });
}; };
Tween.prototype.set = function (props, target) { ScrollListBase.prototype.calMaxDistance = function () {
if (target === void 0) { target = null; } var key = 'item' + this.paramSize.substr(0, 1).toUpperCase() + this.paramSize.substr(1);
this._appendQueueProps(props); return this[key] * Math.ceil(this.data.length / this.cols);
return this._addAction({ f: this._set, o: this, p: [props, target ? target : this._target] });
}; };
Tween.prototype.play = function (tween) { ScrollListBase.prototype.updateData = function (data, isReset) {
if (!tween) { if (isReset === void 0) { isReset = true; }
tween = this; var s = this;
if (!s._isInit || isReset) {
s.data = data;
} }
return this.call(tween.setPaused, tween, [false]); else {
s.data = s.data.concat(data);
}
s._isInit = 1;
s._lastFirstId = -1;
}; };
Tween.prototype.pause = function (tween) { ScrollListBase.prototype.flushData = function () {
if (!tween) { var s = this;
tween = this; var items = s._items;
if (items.length <= 0) {
return;
}
if (s._isInit > 0) {
if (s._updateId != s.viewPort.transform._localID) {
var id = s.viewPort[s.paramXY] > 0 ? 0 : (Math.abs(Math.floor(s.viewPort[s.paramXY] / s._itemRow)) - 1) * s.cols;
id = id < 0 ? 0 : id;
if (id != s._lastFirstId) {
s._lastFirstId = id;
if (id != items[0].id) {
for (var r = 0; r < s.cols; r++) {
if (s.speed > 0) {
items.unshift(items.pop());
}
else {
items.push(items.shift());
}
}
}
}
for (var i = 0; i < s._itemCount; i++) {
var item = items[i];
if (s._isInit == 1) {
item.sli_id = -1;
}
if (item.sli_id != id) {
if (s.data[id]) {
item._initData(s.data[id] ? id : -1, s.data[id]);
}
item[s.paramXY] = Math.floor(id / s.cols) * s._itemRow;
item[s._disParam] = (id % s.cols) * s._itemCol;
if (s.data[id]) {
item.sli_id = id;
item.visible = true;
}
else {
item.sli_id = -1;
item.visible = false;
}
}
id++;
}
s._isInit = 2;
}
} }
return this.call(tween.setPaused, tween, [true]);
}; };
Tween.prototype.$tick = function (delta) { ScrollListBase.prototype.updateViewRect = function () {
if (this.paused) { _super.prototype.updateViewRect.call(this);
return; var s = this;
if (s.itemWidth && s.itemHeight) {
s._updateViewRect();
} }
this.setPosition(this._prevPosition + delta);
}; };
Tween.NONE = 0; ScrollListBase.prototype._updateViewRect = function () {
Tween.LOOP = 1; var s = this;
Tween.REVERSE = 2; if (s._direction === exports.SCROLL_DIRECTION.VERTICAL) {
Tween._tweens = []; if (s.itemHeight <= 0) {
Tween.IGNORE = {}; return;
Tween._plugins = {}; }
Tween._inited = false; s._disParam = "x";
Tween._lastTime = 0; s._itemRow = s.itemHeight;
return Tween; s._itemCol = s.itemWidth;
}());
var Ease = (function () {
function Ease() {
}
Ease.get = function (amount) {
if (amount < -1) {
amount = -1;
} }
if (amount > 1) { else {
amount = 1; if (s.itemWidth <= 0) {
return;
}
s._disParam = "y";
s._itemRow = s.itemWidth;
s._itemCol = s.itemHeight;
} }
return function (t) { var newCount = (Math.ceil(s.distance / s._itemRow) + 1) * s.cols;
if (amount == 0) { if (newCount != s._itemCount) {
return t; if (newCount > s._itemCount) {
for (var i = s._itemCount; i < newCount; i++) {
var item = s.createItem();
item.id = -1;
item.data = null;
s._items.push(item);
s.viewPort.addChild(item);
}
} }
if (amount < 0) { else {
return t * (t * -amount + 1 + amount); for (var i = 0; i < s._itemCount - newCount; i++) {
s.viewPort.removeChild(s._items.pop());
}
} }
return t * ((2 - t) * amount + (1 - amount)); s._itemCount = newCount;
}; s._lastFirstId = -1;
};
Ease.getPowIn = function (pow) {
return function (t) {
return Math.pow(t, pow);
};
};
Ease.getPowOut = function (pow) {
return function (t) {
return 1 - Math.pow(1 - t, pow);
};
};
Ease.getPowInOut = function (pow) {
return function (t) {
if ((t *= 2) < 1)
return 0.5 * Math.pow(t, pow);
return 1 - 0.5 * Math.abs(Math.pow(2 - t, pow));
};
};
Ease.sineIn = function (t) {
return 1 - Math.cos(t * Math.PI / 2);
};
Ease.sineOut = function (t) {
return Math.sin(t * Math.PI / 2);
};
Ease.sineInOut = function (t) {
return -0.5 * (Math.cos(Math.PI * t) - 1);
};
Ease.getBackIn = function (amount) {
return function (t) {
return t * t * ((amount + 1) * t - amount);
};
};
Ease.getBackOut = function (amount) {
return function (t) {
return (--t * t * ((amount + 1) * t + amount) + 1);
};
};
Ease.getBackInOut = function (amount) {
amount *= 1.525;
return function (t) {
if ((t *= 2) < 1)
return 0.5 * (t * t * ((amount + 1) * t - amount));
return 0.5 * ((t -= 2) * t * ((amount + 1) * t + amount) + 2);
};
};
Ease.circIn = function (t) {
return -(Math.sqrt(1 - t * t) - 1);
};
Ease.circOut = function (t) {
return Math.sqrt(1 - (--t) * t);
};
Ease.circInOut = function (t) {
if ((t *= 2) < 1) {
return -0.5 * (Math.sqrt(1 - t * t) - 1);
} }
return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
}; };
Ease.bounceIn = function (t) { ScrollListBase.prototype.createItem = function () {
return 1 - Ease.bounceOut(1 - t); return new this.itemClass();
}; };
Ease.bounceOut = function (t) { ScrollListBase.prototype.setLoading = function (downLoading) {
if (t < 1 / 2.75) { var s = this;
return (7.5625 * t * t); if (s.downL) {
} s.viewPort.removeChild(s.downL);
else if (t < 2 / 2.75) { s.downL = null;
return (7.5625 * (t -= 1.5 / 2.75) * t + 0.75);
} }
else if (t < 2.5 / 2.75) { if (downLoading) {
return (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375); s.downL = downLoading;
s.viewPort.addChild(downLoading);
s.downL[s.paramXY] = Math.max(s.distance, s.maxDistance);
} }
else { else {
return (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375); s.isStop = false;
} }
}; };
Ease.bounceInOut = function (t) { ScrollListBase.prototype.destroy = function () {
if (t < 0.5) var s = this;
return Ease.bounceIn(t * 2) * .5; s._items = null;
return Ease.bounceOut(t * 2 - 1) * 0.5 + 0.5; s.itemClass = null;
}; s.data = null;
Ease.getElasticIn = function (amplitude, period) { s.downL = null;
var pi2 = Math.PI * 2; _super.prototype.destroy.call(this);
return function (t) {
if (t == 0 || t == 1)
return t;
var s = period / pi2 * Math.asin(1 / amplitude);
return -(amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period));
};
};
Ease.getElasticOut = function (amplitude, period) {
var pi2 = Math.PI * 2;
return function (t) {
if (t == 0 || t == 1)
return t;
var s = period / pi2 * Math.asin(1 / amplitude);
return (amplitude * Math.pow(2, -10 * t) * Math.sin((t - s) * pi2 / period) + 1);
};
};
Ease.getElasticInOut = function (amplitude, period) {
var pi2 = Math.PI * 2;
return function (t) {
var s = period / pi2 * Math.asin(1 / amplitude);
if ((t *= 2) < 1)
return -0.5 * (amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period));
return amplitude * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * pi2 / period) * 0.5 + 1;
};
}; };
Ease.quadIn = Ease.getPowIn(2); tslib_1.__decorate([
Ease.quadOut = Ease.getPowOut(2); dirtyFieldTrigger
Ease.quadInOut = Ease.getPowInOut(2); ], ScrollListBase.prototype, "itemWidth", void 0);
Ease.cubicIn = Ease.getPowIn(3); tslib_1.__decorate([
Ease.cubicOut = Ease.getPowOut(3); dirtyFieldTrigger
Ease.cubicInOut = Ease.getPowInOut(3); ], ScrollListBase.prototype, "itemHeight", void 0);
Ease.quartIn = Ease.getPowIn(4); tslib_1.__decorate([
Ease.quartOut = Ease.getPowOut(4); dirtyFieldTrigger
Ease.quartInOut = Ease.getPowInOut(4); ], ScrollListBase.prototype, "cols", void 0);
Ease.quintIn = Ease.getPowIn(5); tslib_1.__decorate([
Ease.quintOut = Ease.getPowOut(5); dirtyFieldTrigger
Ease.quintInOut = Ease.getPowInOut(5); ], ScrollListBase.prototype, "itemClass", void 0);
Ease.backIn = Ease.getBackIn(1.7); return ScrollListBase;
Ease.backOut = Ease.getBackOut(1.7); }(ScrollViewBase));
Ease.backInOut = Ease.getBackInOut(1.7);
Ease.elasticIn = Ease.getElasticIn(1, 0.3);
Ease.elasticOut = Ease.getElasticOut(1, 0.3);
Ease.elasticInOut = Ease.getElasticInOut(1, 0.3 * 1.5);
return Ease;
}());
var Node$1 = (function (_super) { var Node$1 = (function (_super) {
tslib_1.__extends(Node, _super); tslib_1.__extends(Node, _super);
...@@ -21747,101 +21769,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -21747,101 +21769,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
}; };
/**
* Created by rockyl on 2020-01-27.
*/
var genericRegexp = /(\w+)(<(\w+)>)?/;
function compute(props, options) {
var result = props || {};
var _loop_1 = function (key) {
var sourceValue = getValue(result, options, key);
var value = sourceValue;
if (options) {
var option = options[key];
if (option && option.type) {
var _a = parseType(option.type), type = _a.type, generic_1 = _a.generic;
switch (type) {
case 'vector2':
value = parseVector2(sourceValue);
break;
case 'array':
var seps = sourceValue.split(',');
seps = seps.map(function (sep) {
var item;
if (generic_1) {
switch (generic_1) {
case 'number':
item = parseFloat(sep);
break;
case 'boolean':
item = sep === 'true';
break;
default:
item = sep;
break;
}
}
else {
item = sep;
}
return item;
});
value = seps;
break;
}
}
}
result[key] = value;
};
for (var key in options) {
_loop_1(key);
}
return result;
}
function parseType(typeStr) {
var type = typeStr, generic;
var regResult = typeStr.match(genericRegexp);
if (regResult) {
type = regResult[1];
generic = regResult[3];
}
return {
type: type, generic: generic,
};
}
function parseVector2(sourceValue) {
var value = sourceValue;
if (!sourceValue) {
value = { x: undefined, y: undefined };
}
if (typeof sourceValue === 'string') {
var arr = sourceValue.split(',');
value = {
x: arr[0] === '' ? undefined : parseFloat(arr[0]),
y: arr[1] === '' ? undefined : parseFloat(arr[1]),
};
}
else if (Array.isArray(sourceValue)) {
value = {
x: sourceValue[0] === '' ? undefined : parseFloat(sourceValue[0]),
y: sourceValue[1] === '' ? undefined : parseFloat(sourceValue[1]),
};
}
return value;
}
function getValue(props, options, key) {
var value;
if (props.hasOwnProperty(key)) {
value = props[key];
}
else if (options && options[key].hasOwnProperty('default')) {
value = options[key].default;
}
return value;
}
var emojiRegexp = emojiRegex(); var emojiRegexp = emojiRegex();
Object.defineProperty(exports, 'computeProps', {
enumerable: true,
get: function () {
return propsCompute.compute;
}
});
exports.BaseTexture = BaseTexture; exports.BaseTexture = BaseTexture;
exports.BaseTextureCache = BaseTextureCache; exports.BaseTextureCache = BaseTextureCache;
exports.BitmapText = BitmapText; exports.BitmapText = BitmapText;
...@@ -21917,7 +21852,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -21917,7 +21852,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.clearTextureCache = clearTextureCache; exports.clearTextureCache = clearTextureCache;
exports.cmdOldPrefix = cmdOldPrefix; exports.cmdOldPrefix = cmdOldPrefix;
exports.cmdPrefix = cmdPrefix; exports.cmdPrefix = cmdPrefix;
exports.computeProps = compute;
exports.copyProp = copyProp; exports.copyProp = copyProp;
exports.cos = cos; exports.cos = cos;
exports.countTrailingZeros = countTrailingZeros; exports.countTrailingZeros = countTrailingZeros;
...@@ -22033,5 +21967,5 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -22033,5 +21967,5 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Object.defineProperty(exports, '__esModule', { value: true }); Object.defineProperty(exports, '__esModule', { value: true });
})); })));
//# sourceMappingURL=engine.js.map //# sourceMappingURL=engine.js.map
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -33,7 +33,7 @@ function getPxToken(callback) { ...@@ -33,7 +33,7 @@ function getPxToken(callback) {
}; };
xhr.send(); xhr.send();
} else { } else {
callback('need login'); callback('need reload');
} }
function failedCallback() { function failedCallback() {
......
function getPxToken(n){if(window.ohjaiohdf){var o=new XMLHttpRequest;o.open("get","getToken",!0),o.onreadystatechange=function(){if(4===o.readyState&&200===o.status){var e=JSON.parse(o.response);if(e.success)window.eval(e.data),n(null,window.ohjaiohdf());else switch(e.code){case"100001":n("need login");break;case"100024":n("state invalid");break;default:n(e.code)}}},o.onerror=function(e){t()},o.onloadend=function(){404===o.status&&t()},o.send()}else n("need login");function t(){n("net error")}} function getPxToken(n){if(window.ohjaiohdf){var o=new XMLHttpRequest;o.open("get","getToken",!0),o.onreadystatechange=function(){if(4===o.readyState&&200===o.status){var e=JSON.parse(o.response);if(e.success)window.eval(e.data),n(null,window.ohjaiohdf());else switch(e.code){case"100001":n("need login");break;case"100024":n("state invalid");break;default:n(e.code)}}},o.onerror=function(e){t()},o.onloadend=function(){404===o.status&&t()},o.send()}else n("need reload");function t(){n("net error")}}
\ No newline at end of file
import { DisplayObject } from './DisplayObject'; import {DisplayObject} from './DisplayObject';
import { Rectangle } from "../math/Rectangle"; import {Rectangle} from "../math/Rectangle";
import { Point } from '../math/index'; import {Point} from '../math/index';
import CanvasRenderer from '../renderers/CanvasRenderer'; import CanvasRenderer from '../renderers/CanvasRenderer';
import { Event } from "../events/Event" import {Event} from "../events/Event"
import { WebglRenderer } from '../renderers/WebglRenderer'; import {WebglRenderer} from '../renderers/WebglRenderer';
import { applyAutoAdjust } from "../../zeroing/decorators/auto-adjust"; import {applyAutoAdjust} from "../../zeroing/decorators/auto-adjust";
import { applyScript } from "../../zeroing/decorators/scripts"; import {applyScript} from "../../zeroing/decorators/scripts";
import { applyEvents } from "../../zeroing/decorators/events"; import {applyEvents} from "../../zeroing/decorators/events";
import { afterConstructor } from "../../zeroing/decorators/after-constructor"; import {afterConstructor} from "../../zeroing/decorators/after-constructor";
import { injectProperties, instantiateScript, toBoolean } from "../../zeroing/utils/index"; import {injectProperties, instantiateScript, toBoolean} from "../../zeroing/utils/index";
import { isUI } from "../../zeroing/game-warpper/nodes/IUIComponent"; import {isUI} from "../../zeroing/game-warpper/nodes/IUIComponent";
import Transform from "../math/Transform"; import Transform from "../math/Transform";
/** /**
...@@ -24,869 +24,869 @@ import Transform from "../math/Transform"; ...@@ -24,869 +24,869 @@ import Transform from "../math/Transform";
@applyEvents @applyEvents
export default class Container extends DisplayObject { export default class Container extends DisplayObject {
percentWidth: number; percentWidth: number;
percentHeight: number; percentHeight: number;
left: number; left: number;
top: number; top: number;
right: number; right: number;
bottom: number; bottom: number;
horizonCenter: number; horizonCenter: number;
verticalCenter: number; verticalCenter: number;
private _transform: Transform; private _transform: Transform;
private _lastLocalID; private _lastLocalID;
/** /**
* 为false鼠标事件不再向下传递 * 为false鼠标事件不再向下传递
*/ */
_mouseChildren: boolean = true; _mouseChildren: boolean = true;
/** /**
* 孩子们 * 孩子们
* @member {DisplayObject[]} * @member {DisplayObject[]}
* @readonly * @readonly
*/ */
children: any[]; children: any[];
/** /**
* 特殊用处 * 特殊用处
* 缓存的Container的updateTransform * 缓存的Container的updateTransform
*/ */
containerUpdateTransform; containerUpdateTransform;
constructor() { constructor() {
super(); super();
this._instanceType = "Container"; this._instanceType = "Container";
this.children = []; this.children = [];
this._transform = this.transform; this._transform = this.transform;
this.afterConstructor(); this.afterConstructor();
} }
get mouseChildren() { get mouseChildren() {
return this._mouseChildren; return this._mouseChildren;
} }
set mouseChildren(v) { set mouseChildren(v) {
this._mouseChildren = v; this._mouseChildren = v;
} }
afterConstructor() { afterConstructor() {
} }
/** /**
* children改变时 * children改变时
* @private * @private
*/ */
onChildrenChange(index) { onChildrenChange(index) {
/* empty */ /* empty */
//子类需要时重写 //子类需要时重写
this.dispatchEvent(Event.MAYBE_ALIGN); this.dispatchEvent(Event.MAYBE_ALIGN);
} }
attachVisibility() { attachVisibility() {
return; return;
this.dispatchEvent(this.worldVisible ? Event.VISIBLE : Event.HIDDEN); this.dispatchEvent(this.worldVisible ? Event.VISIBLE : Event.HIDDEN);
for (let i = 0, li = this.children.length; i < li; i++) { for (let i = 0, li = this.children.length; i < li; i++) {
const child = <Container>this.children[i]; const child = <Container>this.children[i];
child.attachVisibility(); child.attachVisibility();
} }
} }
/** /**
* 添加child * 添加child
* @param {DisplayObject} child * @param {DisplayObject} child
* @return {DisplayObject} * @return {DisplayObject}
*/ */
addChild(child: DisplayObject): DisplayObject { addChild(child: DisplayObject): DisplayObject {
//默认添加在最顶层 //默认添加在最顶层
this.addChildAt(child, this.children.length); this.addChildAt(child, this.children.length);
return child; return child;
} }
/** /**
* 在相应index处添加child * 在相应index处添加child
* @param {DisplayObject} child - The child to add * @param {DisplayObject} child - The child to add
* @param {number} index - The index to place the child in * @param {number} index - The index to place the child in
* @return {DisplayObject} The child that was added. * @return {DisplayObject} The child that was added.
*/ */
addChildAt(child: DisplayObject, index: number): DisplayObject { addChildAt(child: DisplayObject, index: number): DisplayObject {
if (!child) return; if (!child) return;
let s = this; let s = this;
let sameParent = (s == child.parent); let sameParent = (s == child.parent);
let len: number; let len: number;
if (child.parent) { if (child.parent) {
if (!sameParent) { if (!sameParent) {
child.parent.removeChild(child); child.parent.removeChild(child);
} else { } else {
len = s.children.length; len = s.children.length;
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
if (s.children[i] == child) { if (s.children[i] == child) {
s.children.splice(i, 1); s.children.splice(i, 1);
break; break;
} }
} }
} }
} }
child.parent = s; child.parent = s;
//保证child的transform会被更新 //保证child的transform会被更新
child.transform._parentID = -1; child.transform._parentID = -1;
//确保包围盒重新计算 //确保包围盒重新计算
this._boundsID++; this._boundsID++;
len = s.children.length; len = s.children.length;
if (index >= len) { if (index >= len) {
s.children[s.children.length] = child; s.children[s.children.length] = child;
index = len; index = len;
} else if (index == 0 || index < 0) { } else if (index == 0 || index < 0) {
s.children.unshift(child); s.children.unshift(child);
index = 0; index = 0;
} else { } else {
s.children.splice(index, 0, child); s.children.splice(index, 0, child);
} }
if (s.stage && !sameParent) { if (s.stage && !sameParent) {
// child["_cp"] = true; // child["_cp"] = true;
child._onDispatchBubbledEvent(Event.ADDED_TO_STAGE); child._onDispatchBubbledEvent(Event.ADDED_TO_STAGE);
} }
this.onChildrenChange(index); this.onChildrenChange(index);
return child; return child;
} }
/** /**
* 只用于交换索引 * 只用于交换索引
* @param {DisplayObject} child - First display object to swap * @param {DisplayObject} child - First display object to swap
* @param {DisplayObject} child2 - Second display object to swap * @param {DisplayObject} child2 - Second display object to swap
*/ */
swapChildren(child1: DisplayObject, child2: DisplayObject) { swapChildren(child1: DisplayObject, child2: DisplayObject) {
if (child1 === child2) { if (child1 === child2) {
return; return;
} }
let s = this; let s = this;
let id1 = -1; let id1 = -1;
let id2 = -1; let id2 = -1;
let childCount = s.children.length; let childCount = s.children.length;
if (typeof (child1) == "number") { if (typeof (child1) == "number") {
id1 = child1; id1 = child1;
} else { } else {
id1 = s.getChildIndex(child1); id1 = s.getChildIndex(child1);
} }
if (typeof (child2) == "number") { if (typeof (child2) == "number") {
id2 = child2; id2 = child2;
} else { } else {
id2 = s.getChildIndex(child2); id2 = s.getChildIndex(child2);
} }
if (id1 == id2 || id1 < 0 || id1 >= childCount || id2 < 0 || id2 >= childCount) { if (id1 == id2 || id1 < 0 || id1 >= childCount || id2 < 0 || id2 >= childCount) {
return false; return false;
} else { } else {
let temp: any = s.children[id1]; let temp: any = s.children[id1];
s.children[id1] = s.children[id2]; s.children[id1] = s.children[id2];
s.children[id2] = temp; s.children[id2] = temp;
this.onChildrenChange(id1 < id2 ? id1 : id2); this.onChildrenChange(id1 < id2 ? id1 : id2);
return true; return true;
} }
} }
/** /**
* 获取child的层级索引index * 获取child的层级索引index
* @param {DisplayObject} child - The DisplayObject instance to identify * @param {DisplayObject} child - The DisplayObject instance to identify
* @return {number} The index position of the child display object to identify * @return {number} The index position of the child display object to identify
*/ */
getChildIndex(child: DisplayObject): number { getChildIndex(child: DisplayObject): number {
const index = this.children.indexOf(child); const index = this.children.indexOf(child);
if (index === -1) { if (index === -1) {
return null return null
} }
return index; return index;
} }
/** /**
* 是否含有child * 是否含有child
* @param child * @param child
*/ */
contains(child: DisplayObject): boolean { contains(child: DisplayObject): boolean {
return !!this.getChildIndex(child); return !!this.getChildIndex(child);
} }
/** /**
* 设置child的层级 * 设置child的层级
* @param {DisplayObject} child * @param {DisplayObject} child
* @param {number} index * @param {number} index
*/ */
setChildIndex(child: DisplayObject, index: number) { setChildIndex(child: DisplayObject, index: number) {
this.addChildAt(child, index); this.addChildAt(child, index);
} }
/** /**
* Returns the child at the specified index * Returns the child at the specified index
* @param {number} index - The index to get the child at * @param {number} index - The index to get the child at
* @return {DisplayObject} The child at the given index, if any. * @return {DisplayObject} The child at the given index, if any.
*/ */
getChildAt(index: number): DisplayObject { getChildAt(index: number): DisplayObject {
if (index < 0 || index >= this.children.length) { if (index < 0 || index >= this.children.length) {
return null return null
} }
return this.children[index]; return this.children[index];
} }
/** /**
* 根据路径获取子节点 * 根据路径获取子节点
* @param path * @param path
* @param method * @param method
*/ */
getChildByPath(path: any, method: string): DisplayObject { getChildByPath(path: any, method: string): DisplayObject {
if (!path) { if (!path) {
return null; return null;
} }
let p = this; let p = this;
while (path.length > 0) { while (path.length > 0) {
let segment = path.shift(); let segment = path.shift();
p = p[method](segment); p = p[method](segment);
if (!p) { if (!p) {
break; break;
} }
} }
return p; return p;
} }
/** /**
* 根据名称路径获取子节点 * 根据名称路径获取子节点
* @param path * @param path
*/ */
getChildByNamePath(path: string): DisplayObject { getChildByNamePath(path: string): DisplayObject {
const pathArr = path.split('/'); const pathArr = path.split('/');
return this.getChildByPath(pathArr, 'getChildByName'); return this.getChildByPath(pathArr, 'getChildByName');
} }
/** /**
* 根据索引路径获取子节点 * 根据索引路径获取子节点
* @param path * @param path
*/ */
getChildByIndexPath(path: string): DisplayObject { getChildByIndexPath(path: string): DisplayObject {
const pathArr = path.split('/').map(seg => parseInt(seg)); const pathArr = path.split('/').map(seg => parseInt(seg));
return this.getChildByPath(pathArr, 'getChildAt'); return this.getChildByPath(pathArr, 'getChildAt');
} }
/** /**
* 根据uuid搜索子节点 * 根据uuid搜索子节点
* @param uuid * @param uuid
*/ */
findChildByUUID(uuid: string) { findChildByUUID(uuid: string) {
if (this['uuid'] === uuid) { if (this['uuid'] === uuid) {
return this; return this;
} }
if (this.children && this.children.length > 0) { if (this.children && this.children.length > 0) {
for (let child of this.children) { for (let child of this.children) {
if (child.findChildByUUID) { if (child.findChildByUUID) {
let target = child.findChildByUUID(uuid); let target = child.findChildByUUID(uuid);
if (target) { if (target) {
return target; return target;
} }
} }
} }
} }
} }
/** /**
* 通过名字获取子级 * 通过名字获取子级
* @param name * @param name
* @param isOnlyOne * @param isOnlyOne
* @param isRecursive * @param isRecursive
*/ */
public getChildByName(name: string | RegExp, isOnlyOne: boolean = true, isRecursive: boolean = false): any { public getChildByName(name: string | RegExp, isOnlyOne: boolean = true, isRecursive: boolean = false): any {
if (!name) return null; if (!name) return null;
let s = this; let s = this;
let rex: any; let rex: any;
if (typeof (name) == "string") { if (typeof (name) == "string") {
rex = new RegExp("^" + name + "$"); rex = new RegExp("^" + name + "$");
} else { } else {
rex = name; rex = name;
} }
let elements: Array<DisplayObject> = []; let elements: Array<DisplayObject> = [];
Container._getElementsByName(rex, s, isOnlyOne, isRecursive, elements); Container._getElementsByName(rex, s, isOnlyOne, isRecursive, elements);
let len = elements.length; let len = elements.length;
if (len == 0) { if (len == 0) {
return null; return null;
} else if (len == 1) { } else if (len == 1) {
return elements[0]; return elements[0];
} else { } else {
return elements; return elements;
} }
} }
/** /**
* 移除child * 移除child
* @param {DisplayObject} child * @param {DisplayObject} child
* @return {DisplayObject} * @return {DisplayObject}
*/ */
removeChild(child: DisplayObject): DisplayObject { removeChild(child: DisplayObject): DisplayObject {
const index = this.children.indexOf(child); const index = this.children.indexOf(child);
if (index === -1) return null; if (index === -1) return null;
this.removeChildAt(index); this.removeChildAt(index);
return child; return child;
} }
/** /**
* 在index处移除child * 在index处移除child
* @param {number} index - The index to get the child from * @param {number} index - The index to get the child from
* @return {DisplayObject} The child that was removed. * @return {DisplayObject} The child that was removed.
*/ */
removeChildAt(index: number): DisplayObject { removeChildAt(index: number): DisplayObject {
let s = this; let s = this;
let child: any; let child: any;
let len = s.children.length - 1; let len = s.children.length - 1;
if (len < 0) return; if (len < 0) return;
if (index == len) { if (index == len) {
child = s.children.pop(); child = s.children.pop();
} else if (index == 0) { } else if (index == 0) {
child = s.children.shift(); child = s.children.shift();
} else { } else {
child = s.children.splice(index, 1)[0]; child = s.children.splice(index, 1)[0];
} }
child._onDispatchBubbledEvent(Event.REMOVED_FROM_STAGE); child._onDispatchBubbledEvent(Event.REMOVED_FROM_STAGE);
//保证子级会被更新 //保证子级会被更新
child.parent = null; child.parent = null;
child.transform._parentID = -1; child.transform._parentID = -1;
//保证包围盒重新计算 //保证包围盒重新计算
this._boundsID++; this._boundsID++;
this.onChildrenChange(index); this.onChildrenChange(index);
return child; return child;
} }
/** /**
* 通过索引批量移除child * 通过索引批量移除child
* @param {number} [beginIndex=0] * @param {number} [beginIndex=0]
* @param {number} [endIndex=this.children.length] * @param {number} [endIndex=this.children.length]
* @returns {DisplayObject[]} List of removed children * @returns {DisplayObject[]} List of removed children
*/ */
removeChildren(beginIndex: number = 0, endIndex: number = this.children.length): DisplayObject[] { removeChildren(beginIndex: number = 0, endIndex: number = this.children.length): DisplayObject[] {
const begin = beginIndex; const begin = beginIndex;
const end = typeof endIndex === 'number' ? endIndex : this.children.length; const end = typeof endIndex === 'number' ? endIndex : this.children.length;
const range = end - begin; const range = end - begin;
let removed; let removed;
if (range > 0 && range <= end) { if (range > 0 && range <= end) {
removed = this.children.splice(begin, range); removed = this.children.splice(begin, range);
for (let i = 0; i < removed.length; ++i) { for (let i = 0; i < removed.length; ++i) {
removed[i].parent = null; removed[i].parent = null;
if (removed[i].transform) { if (removed[i].transform) {
removed[i].transform._parentID = -1; removed[i].transform._parentID = -1;
} }
} }
this._boundsID++; this._boundsID++;
this.onChildrenChange(beginIndex); this.onChildrenChange(beginIndex);
for (let i = 0; i < removed.length; ++i) { for (let i = 0; i < removed.length; ++i) {
removed[i]._onDispatchBubbledEvent(Event.REMOVED_FROM_STAGE); removed[i]._onDispatchBubbledEvent(Event.REMOVED_FROM_STAGE);
} }
return removed; return removed;
} else if (range === 0 && this.children.length === 0) { } else if (range === 0 && this.children.length === 0) {
return []; return [];
} }
throw new RangeError('removeChildren: numeric values are outside the acceptable range.'); throw new RangeError('removeChildren: numeric values are outside the acceptable range.');
} }
/** /**
* 更新矩阵 * 更新矩阵
*/ */
updateTransform() { updateTransform() {
//自己先算 //自己先算
super.updateTransform(); super.updateTransform();
//考虑是否要加, //考虑是否要加,
this._boundsID++; this._boundsID++;
//children遍历计算 //children遍历计算
for (let i = 0, j = this.children.length; i < j; ++i) { for (let i = 0, j = this.children.length; i < j; ++i) {
const child = this.children[i]; const child = this.children[i];
if (child.visible) { if (child.visible) {
child.updateTransform(); child.updateTransform();
} }
} }
/*if(this._transform === this.transform && isUI(this) && this._lastLocalID !== this.transform.localID){ /*if(this._transform === this.transform && isUI(this) && this._lastLocalID !== this.transform.localID){
this._lastLocalID = this.transform.localID; this._lastLocalID = this.transform.localID;
//console.log(this.name, this.instanceId , 'dirty!'); //console.log(this.name, this.instanceId , 'dirty!');
this.stage.layoutInvalid = true; this.stage.layoutInvalid = true;
}*/ }*/
} }
/** /**
* 父类重写 * 父类重写
* 都是全局的 * 都是全局的
*/ */
calculateBounds() { calculateBounds() {
if (this._lastBoundsID == this._boundsID) return if (this._lastBoundsID == this._boundsID) return
this._lastBoundsID = this._boundsID this._lastBoundsID = this._boundsID
this._bounds.clear(); this._bounds.clear();
//算自己的 //算自己的
this._calculateBounds(); this._calculateBounds();
for (let i = 0; i < this.children.length; i++) { for (let i = 0; i < this.children.length; i++) {
const child = this.children[i]; const child = this.children[i];
if (!child.visible || !child.renderable) { if (!child.visible || !child.renderable) {
continue; continue;
} }
child.calculateBounds(); child.calculateBounds();
if (child.$mask) { if (child.$mask) {
child.$mask.calculateBounds(); child.$mask.calculateBounds();
//取交集矩形 //取交集矩形
if (child._bounds.x < child.$mask._bounds.x) { if (child._bounds.x < child.$mask._bounds.x) {
child._bounds.x = child.$mask._bounds.x; child._bounds.x = child.$mask._bounds.x;
} }
if (child._bounds.y < child.$mask._bounds.y) { if (child._bounds.y < child.$mask._bounds.y) {
child._bounds.y = child.$mask._bounds.y; child._bounds.y = child.$mask._bounds.y;
} }
if (child._bounds.width > child.$mask._bounds.width) { if (child._bounds.width > child.$mask._bounds.width) {
child._bounds.width = child.$mask._bounds.width; child._bounds.width = child.$mask._bounds.width;
} }
if (child._bounds.height > child.$mask._bounds.height) { if (child._bounds.height > child.$mask._bounds.height) {
child._bounds.height = child.$mask._bounds.height; child._bounds.height = child.$mask._bounds.height;
} }
Rectangle.createFromRects(this._bounds, child._bounds); Rectangle.createFromRects(this._bounds, child._bounds);
} else { } else {
Rectangle.createFromRects(this._bounds, child._bounds); Rectangle.createFromRects(this._bounds, child._bounds);
} }
} }
} }
/** /**
* 加"_"的方法基本是为了自己特殊处理 * 加"_"的方法基本是为了自己特殊处理
*/ */
protected _calculateBounds(): boolean { protected _calculateBounds(): boolean {
//子类自己重写 //子类自己重写
//let wp = this.worldMatrix.transformPoint(this.x, this.y); //let wp = this.worldMatrix.transformPoint(this.x, this.y);
let widthSetted = !!this._width && this._width !== 0; let widthSetted = !!this._width && this._width !== 0;
let heightSetted = !!this._height && this._height !== 0; let heightSetted = !!this._height && this._height !== 0;
/*if (widthSetted) { /*if (widthSetted) {
this._bounds.x = this.x; this._bounds.x = this.x;
this._bounds.width = this._width; this._bounds.width = this._width;
} }
if (heightSetted) { if (heightSetted) {
this._bounds.y = this.y; this._bounds.y = this.y;
this._bounds.height = this._height; this._bounds.height = this._height;
}*/ }*/
if (widthSetted || heightSetted) { if (widthSetted || heightSetted) {
const rect = this._localBoundsSelf; const rect = this._localBoundsSelf;
var matrix = this.transform.worldMatrix; var matrix = this.transform.worldMatrix;
matrix.transformPoint(rect.x, rect.y, DisplayObject._p1); matrix.transformPoint(rect.x, rect.y, DisplayObject._p1);
matrix.transformPoint(rect.x + rect.width, rect.y, DisplayObject._p2); matrix.transformPoint(rect.x + rect.width, rect.y, DisplayObject._p2);
matrix.transformPoint(rect.x + rect.width, rect.y + rect.height, DisplayObject._p3); matrix.transformPoint(rect.x + rect.width, rect.y + rect.height, DisplayObject._p3);
matrix.transformPoint(rect.x, rect.y + rect.height, DisplayObject._p4); matrix.transformPoint(rect.x, rect.y + rect.height, DisplayObject._p4);
Rectangle.createFromPoints(this._bounds, DisplayObject._p1, DisplayObject._p2, DisplayObject._p3, DisplayObject._p4); Rectangle.createFromPoints(this._bounds, DisplayObject._p1, DisplayObject._p2, DisplayObject._p3, DisplayObject._p4);
return true; return true;
} }
return false; return false;
} }
/** /**
* 检测点是否在任何child上 * 检测点是否在任何child上
* 重写父类方法 * 重写父类方法
*/ */
hitTestPoint(globalPoint: Point, isMouseEvent: boolean = false) { hitTestPoint(globalPoint: Point, isMouseEvent: boolean = false) {
//如果不可见 //如果不可见
if (!this.visible) return null if (!this.visible) return null
//如果禁止子级的鼠标事件 //如果禁止子级的鼠标事件
if (isMouseEvent && !this.mouseChildren) { if (isMouseEvent && !this.mouseChildren) {
return this.hitTestSelf(globalPoint); return this.hitTestSelf(globalPoint);
} }
var children = this.children; var children = this.children;
var length = children.length; var length = children.length;
let child, hitDisplayObject; let child, hitDisplayObject;
//后序遍历,后添加的在上层 //后序遍历,后添加的在上层
for (var i = length - 1; i >= 0; i--) { for (var i = length - 1; i >= 0; i--) {
child = children[i]; child = children[i];
//当作遮罩的不作为检测,跳过 //当作遮罩的不作为检测,跳过
if (child.isUsedToMask) continue; if (child.isUsedToMask) continue;
//有遮罩,但是不在遮罩内,跳过 //有遮罩,但是不在遮罩内,跳过
if (child.mask && !child.mask.hitTestPoint(globalPoint, isMouseEvent)) continue; if (child.mask && !child.mask.hitTestPoint(globalPoint, isMouseEvent)) continue;
//检测 //检测
hitDisplayObject = child.hitTestPoint(globalPoint, isMouseEvent); hitDisplayObject = child.hitTestPoint(globalPoint, isMouseEvent);
//存在直接返回 //存在直接返回
if (hitDisplayObject) return hitDisplayObject; if (hitDisplayObject) return hitDisplayObject;
} }
return this.displayObjectHitTestPoint(globalPoint, isMouseEvent); return this.displayObjectHitTestPoint(globalPoint, isMouseEvent);
} }
hitTestSelf(globalPoint) { hitTestSelf(globalPoint) {
if (this.mouseEnabled) { if (this.mouseEnabled) {
return this.hitTestSelfBounds(globalPoint); return this.hitTestSelfBounds(globalPoint);
} }
return null; return null;
} }
hitTestSelfBounds(globalPoint) { hitTestSelfBounds(globalPoint) {
if (this._width && this._height) { if (this._width && this._height) {
//let {x: tx, y: ty} = this.getBounds(); //let {x: tx, y: ty} = this.getBounds();
let {tx, ty} = this.worldMatrix; let {tx, ty} = this.worldMatrix;
const {x, y} = globalPoint; const {x, y} = globalPoint;
if (x > tx && if (x > tx &&
x < tx + this.width && x < tx + this.width &&
y > ty && y > ty &&
y < ty + this.height y < ty + this.height
) return this; ) return this;
} }
return null return null
} }
/** /**
* webgl渲染 * webgl渲染
* @param {WebglRenderer} renderer - The renderer * @param {WebglRenderer} renderer - The renderer
*/ */
renderWebGL(renderer: WebglRenderer) { renderWebGL(renderer: WebglRenderer) {
//不可见,全局透明度为0,或者 不渲染,直接return //不可见,全局透明度为0,或者 不渲染,直接return
if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {
return; return;
} }
//是否有遮罩。到时如果有滤镜, //是否有遮罩。到时如果有滤镜,
if (this.mask) { if (this.mask) {
this.renderAdvancedWebGL(renderer); this.renderAdvancedWebGL(renderer);
} else { } else {
//自身先渲染 //自身先渲染
this._renderWebGL(renderer); this._renderWebGL(renderer);
//遍历children //遍历children
for (let i = 0, j = this.children.length; i < j; ++i) { for (let i = 0, j = this.children.length; i < j; ++i) {
this.children[i].renderWebGL(renderer); this.children[i].renderWebGL(renderer);
} }
} }
} }
/** /**
* 高级渲染方法 * 高级渲染方法
* *
* @private * @private
* @param {WebGLRenderer} renderer - The renderer * @param {WebGLRenderer} renderer - The renderer
*/ */
private renderAdvancedWebGL(renderer: WebglRenderer) { private renderAdvancedWebGL(renderer: WebglRenderer) {
//之前的批处理刷掉先 //之前的批处理刷掉先
renderer.batchManager.flush(); renderer.batchManager.flush();
//有滤镜再说 //有滤镜再说
const mask = this.mask; const mask = this.mask;
if (mask) { if (mask) {
//先画遮罩 //先画遮罩
renderer.maskManager.pushMask(this, this.mask); renderer.maskManager.pushMask(this, this.mask);
} }
//渲染自身 //渲染自身
this._renderWebGL(renderer); this._renderWebGL(renderer);
//遍历children //遍历children
for (let i = 0, j = this.children.length; i < j; i++) { for (let i = 0, j = this.children.length; i < j; i++) {
this.children[i].renderWebGL(renderer); this.children[i].renderWebGL(renderer);
} }
//刷掉批处理 //刷掉批处理
renderer.batchManager.flush(); renderer.batchManager.flush();
if (mask) { if (mask) {
//移除遮罩,支持多重遮罩 //移除遮罩,支持多重遮罩
renderer.maskManager.popMask(this, this.mask); renderer.maskManager.popMask(this, this.mask);
} }
} }
/** /**
* 自身渲染方式 * 自身渲染方式
* @private * @private
* @param {WebglRenderer} renderer - The renderer * @param {WebglRenderer} renderer - The renderer
*/ */
protected _renderWebGL(renderer: WebglRenderer) { protected _renderWebGL(renderer: WebglRenderer) {
//自身绘制方法 //自身绘制方法
} }
/** /**
* canvas渲染方式 * canvas渲染方式
* @param {CanvasRenderer} renderer - The renderer * @param {CanvasRenderer} renderer - The renderer
*/ */
renderCanvas(renderer: CanvasRenderer) { renderCanvas(renderer: CanvasRenderer) {
if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {
return; return;
} }
if (this.mask) { if (this.mask) {
renderer.maskManager.pushMask(this.mask); renderer.maskManager.pushMask(this.mask);
} }
this._renderCanvas(renderer); this._renderCanvas(renderer);
for (let i = 0, j = this.children.length; i < j; ++i) { for (let i = 0, j = this.children.length; i < j; ++i) {
this.children[i].renderCanvas(renderer); this.children[i].renderCanvas(renderer);
} }
if (this.mask) { if (this.mask) {
renderer.maskManager.popMask(renderer); renderer.maskManager.popMask(renderer);
} }
} }
/** /**
* 自身渲染方法 * 自身渲染方法
* *
* @private * @private
* @param {CanvasRenderer} renderer - The renderer * @param {CanvasRenderer} renderer - The renderer
*/ */
protected _renderCanvas(renderer: CanvasRenderer) { protected _renderCanvas(renderer: CanvasRenderer) {
//自身绘制方法 //自身绘制方法
} }
/** /**
* 更新方法 * 更新方法
*/ */
update(deltaTime: number) { update(deltaTime: number) {
/*if (!this.visible) return;*/ /*if (!this.visible) return;*/
//更新自己的 //更新自己的
super.update(deltaTime) super.update(deltaTime)
//更新儿子们的 //更新儿子们的
let len = this.children.length; let len = this.children.length;
for (let i = len - 1; i >= 0; i--) { for (let i = len - 1; i >= 0; i--) {
const child = this.children[i]; const child = this.children[i];
/*if (child.visible)*/ /*if (child.visible)*/
child.update(deltaTime); child.update(deltaTime);
} }
} }
/** /**
* 调用此方法对自己及其child触发一次指定事件 * 调用此方法对自己及其child触发一次指定事件
* @method _onDispatchBubbledEvent * @method _onDispatchBubbledEvent
* @public * @public
* @param {string} type * @param {string} type
* @since 1.0.0 * @since 1.0.0
*/ */
public _onDispatchBubbledEvent(type: string): void { public _onDispatchBubbledEvent(type: string): void {
let s = this; let s = this;
let len = s.children.length; let len = s.children.length;
if (type == Event.REMOVED_FROM_STAGE && !s.stage) return; if (type == Event.REMOVED_FROM_STAGE && !s.stage) return;
super._onDispatchBubbledEvent(type); super._onDispatchBubbledEvent(type);
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
s.children[i]._onDispatchBubbledEvent(type); s.children[i]._onDispatchBubbledEvent(type);
} }
} }
/** /**
* *
*/ */
destroy() { destroy() {
let s = this; let s = this;
//让子级也destroy //让子级也destroy
for (let i = s.children.length - 1; i >= 0; i--) { for (let i = s.children.length - 1; i >= 0; i--) {
s.children[i].destroy(); s.children[i].destroy();
} }
super.destroy(); super.destroy();
this.mouseChildren = false; this.mouseChildren = false;
} }
/** /**
* 一般用于获取宽高并设置 * 一般用于获取宽高并设置
* 包括子级的,容器的尽量少用,子类可重写 * 包括子级的,容器的尽量少用,子类可重写
* @member {number} * @member {number}
*/ */
get width(): number { get width(): number {
let value = this._width; let value = this._width;
return !value && value != 0 ? this.scale.x * this.getLocalBounds().width : value; return !value && value != 0 ? this.scale.x * this.getLocalBounds().width : value;
} }
set width(value: number) { set width(value: number) {
// const width = this.getLocalBounds().width; // const width = this.getLocalBounds().width;
// if (width !== 0) { // if (width !== 0) {
// this.scale.x = value / width; // this.scale.x = value / width;
// } else { // } else {
// this.scale.x = 1; // this.scale.x = 1;
// } // }
if (this._width !== value) { if (this._width !== value) {
if (!value && value != 0) { if (!value && value != 0) {
this._width = undefined; this._width = undefined;
} else { } else {
//子类有用,有_width,才需设置scaleX //子类有用,有_width,才需设置scaleX
this._width = value; this._width = value;
this._localBoundsSelf.width = value; this._localBoundsSelf.width = value;
//if (this.stage) this.stage.layoutInvalid = true; //if (this.stage) this.stage.layoutInvalid = true;
} }
this.dispatchEvent(Event.RESIZE); this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN); this.dispatchEvent(Event.MAYBE_ALIGN);
// 如果它设置了 percentWidth 或同时设置了 left 和 right 则表示他的宽度是相对的,则对于父级来说它的宽度永远是 0 // 如果它设置了 percentWidth 或同时设置了 left 和 right 则表示他的宽度是相对的,则对于父级来说它的宽度永远是 0
this.__width = (toBoolean(this.percentWidth) || (toBoolean(this.left) && toBoolean(this.right))) this.__width = (toBoolean(this.percentWidth) || (toBoolean(this.left) && toBoolean(this.right)))
? 0 ? 0
: value; : value;
} }
} }
/** /**
* 高度同width * 高度同width
* @member {number} * @member {number}
*/ */
get height(): number { get height(): number {
let value = this._height; let value = this._height;
return !value && value != 0 ? this.scale.y * this.getLocalBounds().height : value; return !value && value != 0 ? this.scale.y * this.getLocalBounds().height : value;
} }
set height(value: number) { set height(value: number) {
// const height = this.getLocalBounds().height; // const height = this.getLocalBounds().height;
// if (height !== 0) { // if (height !== 0) {
// this.scale.y = value / height; // this.scale.y = value / height;
// } else { // } else {
// this.scale.y = 1; // this.scale.y = 1;
// } // }
if (!value && value != 0) { if (!value && value != 0) {
this._height = undefined; this._height = undefined;
} else { } else {
if (this._height !== value) { if (this._height !== value) {
this._height = value; this._height = value;
this._localBoundsSelf.height = value; this._localBoundsSelf.height = value;
//if (this.stage) this.stage.layoutInvalid = true; //if (this.stage) this.stage.layoutInvalid = true;
} }
this.dispatchEvent(Event.RESIZE); this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN); this.dispatchEvent(Event.MAYBE_ALIGN);
// 如果它设置了 percentHeight 或同时设置了 top 和 bottom 则表示他的高度是相对的,则对于父级来说它的高度永远是 0 // 如果它设置了 percentHeight 或同时设置了 top 和 bottom 则表示他的高度是相对的,则对于父级来说它的高度永远是 0
this.__height = (toBoolean(this.percentHeight) || (toBoolean(this.top) && toBoolean(this.bottom))) this.__height = (toBoolean(this.percentHeight) || (toBoolean(this.top) && toBoolean(this.bottom)))
? 0 ? 0
: value; : value;
} }
} }
protected __width = 0; // 忽略 相对宽度 的 宽度,在父级计算自动宽度的时候用到 protected __width = 0; // 忽略 相对宽度 的 宽度,在父级计算自动宽度的时候用到
protected __height = 0; // 忽略 相对高度 的 高度,在父级计算自动高度的时候用到 protected __height = 0; // 忽略 相对高度 的 高度,在父级计算自动高度的时候用到
get x(): number { get x(): number {
return this.position.x; return this.position.x;
} }
set x(value: number) { set x(value: number) {
if(this.destroyed){ if (this.destroyed) {
return; return;
} }
if (value == this.transform.position.x) return; if (value == this.transform.position.x) return;
this.transform.position.x = value; this.transform.position.x = value;
this.dispatchEvent(Event.MAYBE_ALIGN); this.dispatchEvent(Event.MAYBE_ALIGN);
} }
get y(): number { get y(): number {
return this.position.y; return this.position.y;
} }
set y(value: number) { set y(value: number) {
if(this.destroyed){ if (this.destroyed) {
return; return;
} }
if (value == this.transform.position.y) return; if (value == this.transform.position.y) return;
this.transform.position.y = value; this.transform.position.y = value;
this.dispatchEvent(Event.MAYBE_ALIGN); this.dispatchEvent(Event.MAYBE_ALIGN);
} }
clone(withEvents = false, withScripts = false) { clone(withEvents = false, withScripts = false) {
let target = this.constructor.apply(Object.create(this.constructor.prototype)); let target = this.constructor.apply(Object.create(this.constructor.prototype));
const originConfig = this['__originConfig']; const originConfig = this['__originConfig'];
const {name, properties, events, scripts} = originConfig; const {name, properties, events, scripts} = originConfig;
target.name = name; target.name = name;
target['__originConfig'] = originConfig; target['__originConfig'] = originConfig;
injectProperties(target, properties); injectProperties(target, properties);
if (withScripts) { if (withScripts) {
if (scripts && scripts.length > 0) { if (scripts && scripts.length > 0) {
for (let scriptConfig of scripts) { for (let scriptConfig of scripts) {
instantiateScript(target, scriptConfig); instantiateScript(target, scriptConfig);
} }
} }
} }
if (withEvents) { if (withEvents) {
if (events) { if (events) {
target.eventsProxy.start(events); target.eventsProxy.start(events);
} }
} }
for (let child of this.children) { for (let child of this.children) {
let childCopy = child.clone(withEvents, withScripts); let childCopy = child.clone(withEvents, withScripts);
target.addChild(childCopy); target.addChild(childCopy);
} }
return target; return target;
} }
get $store() { get $store() {
let p = this; let p = this;
do { do {
if (p['$isViewRoot']) { if (p['$isViewRoot']) {
break; break;
} }
p = p.parent; p = p.parent;
} }
while (p.parent); while (p.parent);
if (p) { if (p) {
return p['$_store']; return p['$_store'];
} }
} }
//全局遍历 //全局遍历
/** /**
* @method _getElementsByName * @method _getElementsByName
* @param {RegExp} rex * @param {RegExp} rex
* @param {Container} root * @param {Container} root
* @param {boolean} isOnlyOne * @param {boolean} isOnlyOne
* @param {boolean} isRecursive * @param {boolean} isRecursive
* @param {Array<DisplayObject>} resultList * @param {Array<DisplayObject>} resultList
* @private * @private
* @static * @static
*/ */
private static _getElementsByName(rex: RegExp, root: Container, isOnlyOne: boolean, isRecursive: boolean, resultList: Array<DisplayObject>): void { private static _getElementsByName(rex: RegExp, root: Container, isOnlyOne: boolean, isRecursive: boolean, resultList: Array<DisplayObject>): void {
let len = root.children.length; let len = root.children.length;
if (len > 0) { if (len > 0) {
let name: string; let name: string;
let child: any; let child: any;
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
child = root.children[i]; child = root.children[i];
name = child.name; name = child.name;
if (name && name != "") { if (name && name != "") {
if (rex.test(name)) { if (rex.test(name)) {
resultList[resultList.length] = child; resultList[resultList.length] = child;
if (isOnlyOne) { if (isOnlyOne) {
return; return;
} }
} }
} }
if (isRecursive) { if (isRecursive) {
if (child["children"] != null) { if (child["children"] != null) {
Container._getElementsByName(rex, child, isOnlyOne, isRecursive, resultList); Container._getElementsByName(rex, child, isOnlyOne, isRecursive, resultList);
} }
} }
} }
} }
} }
} }
Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; Container.prototype.containerUpdateTransform = Container.prototype.updateTransform;
...@@ -40,6 +40,11 @@ export class FloatDisplay extends DisplayObject { ...@@ -40,6 +40,11 @@ export class FloatDisplay extends DisplayObject {
*/ */
private _transformID: number; private _transformID: number;
/**
* 记录是否需要修改位置矩阵
*/
private _shouldUpdateStyle: boolean;
/** /**
* 构造函数 * 构造函数
* @method FloatDisplay * @method FloatDisplay
...@@ -89,13 +94,9 @@ export class FloatDisplay extends DisplayObject { ...@@ -89,13 +94,9 @@ export class FloatDisplay extends DisplayObject {
this._transformID = -1; this._transformID = -1;
} }
addHtmlElement() { addHtmlElement(el?) {
let s = this; let s = this;
if(!s.stage){
return;
}
if (!container) { if (!container) {
container = document.createElement('div'); container = document.createElement('div');
container.style.position = "absolute"; container.style.position = "absolute";
...@@ -105,16 +106,26 @@ export class FloatDisplay extends DisplayObject { ...@@ -105,16 +106,26 @@ export class FloatDisplay extends DisplayObject {
container.style.lineHeight = 'normal'; container.style.lineHeight = 'normal';
s.stage.rootDiv.appendChild(container);//, s.stage.rootDiv.childNodes[0] s.stage.rootDiv.appendChild(container);//, s.stage.rootDiv.childNodes[0]
} }
if (s._htmlElement) { if (s._htmlElement) {
let style = s._htmlElement.style; try {
if (!s._isAdded) { container.removeChild(s._htmlElement);
s._isAdded = true; }catch (e){
container.appendChild(s._htmlElement);
s.stage["_floatDisplayList"].push(s); }
} else { }
if (s._htmlElement && s.visible) { if(el){
style.display = "block"; s._htmlElement = el;
} }
container.appendChild(s._htmlElement);
if (!s._isAdded) {
s._isAdded = true;
s.stage["_floatDisplayList"].push(s);
} else {
if (s._htmlElement && s.visible) {
let style = s._htmlElement.style;
style.display = "block";
} }
} }
} }
...@@ -124,6 +135,7 @@ export class FloatDisplay extends DisplayObject { ...@@ -124,6 +135,7 @@ export class FloatDisplay extends DisplayObject {
} }
set htmlElement(v) { set htmlElement(v) {
this._shouldUpdateStyle = true;
this.init(v); this.init(v);
this.updateStyle(); this.updateStyle();
} }
...@@ -169,9 +181,13 @@ export class FloatDisplay extends DisplayObject { ...@@ -169,9 +181,13 @@ export class FloatDisplay extends DisplayObject {
// s._bounds.height = h; // s._bounds.height = h;
s._localBoundsSelf.width = w; s._localBoundsSelf.width = w;
s._localBoundsSelf.height = h; s._localBoundsSelf.height = h;
s._htmlElement = she;
this.addHtmlElement(); if (!s.stage) {
s._htmlElement = she;
return;
}
this.addHtmlElement(she);
} }
/** /**
...@@ -227,7 +243,8 @@ export class FloatDisplay extends DisplayObject { ...@@ -227,7 +243,8 @@ export class FloatDisplay extends DisplayObject {
style.display = show; style.display = show;
} }
if (visible) { if (visible) {
if (this._transformID != this.transform._worldID) { if (this._shouldUpdateStyle || this._transformID != this.transform._worldID) {
this._shouldUpdateStyle = false;
this._transformID = this.transform._worldID this._transformID = this.transform._worldID
let mtx = s.transform.worldMatrix; let mtx = s.transform.worldMatrix;
let d = devicePixelRatio; let d = devicePixelRatio;
......
...@@ -19,7 +19,6 @@ class AlignManager { ...@@ -19,7 +19,6 @@ class AlignManager {
* flash (渲染前) * flash (渲染前)
*/ */
public flush() { public flush() {
const list = this.alignList; const list = this.alignList;
list.forEach((v: Container) => { list.forEach((v: Container) => {
......
...@@ -134,11 +134,11 @@ export class GameStage extends Node { ...@@ -134,11 +134,11 @@ export class GameStage extends Node {
await this.loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete); await this.loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete);
this.start();
dealPxEnv(); dealPxEnv();
dealPageRemainTime(); dealPageRemainTime();
this.start();
onStart && onStart(); onStart && onStart();
setTimeout(this.lazyLoadAllAssets, setTimeout(this.lazyLoadAllAssets,
......
...@@ -224,8 +224,6 @@ export class TextInput extends Label implements IUIComponent { ...@@ -224,8 +224,6 @@ export class TextInput extends Label implements IUIComponent {
this.fillColor = this._oldFillColor; this.fillColor = this._oldFillColor;
this.strokeColor = this._oldStrokeColor; this.strokeColor = this._oldStrokeColor;
this.dispatchEvent(Event.BLUR);
} }
private onFocus = (e) => { private onFocus = (e) => {
...@@ -235,6 +233,8 @@ export class TextInput extends Label implements IUIComponent { ...@@ -235,6 +233,8 @@ export class TextInput extends Label implements IUIComponent {
private onBlur = (e) => { private onBlur = (e) => {
this.setBlur(); this.setBlur();
this.dispatchEvent(Event.BLUR);
delayScrollTop(); delayScrollTop();
}; };
......
...@@ -4,20 +4,21 @@ ...@@ -4,20 +4,21 @@
const storeKey = 'zlog-switch'; const storeKey = 'zlog-switch';
export enum Logs{ export enum Logs {
PROCESS = 'process', PROCESS = 'process',
} }
let store; let store;
try { try {
store = JSON.parse(localStorage.getItem(storeKey)); let t = localStorage.getItem(storeKey);
store = t ? JSON.parse(t) : null;
store = store === null ? false : store; store = store === null ? false : store;
} catch (e) { } catch (e) {
store = false; store = false;
localStorage.setItem(storeKey, JSON.stringify(store)); localStorage.setItem(storeKey, JSON.stringify(store));
} }
export function getLogSwitch(id):boolean | Array { export function getLogSwitch(id): boolean | Array {
return typeof store === 'object' ? store[id] : !!store; return typeof store === 'object' ? store[id] : !!store;
} }
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
<module type="WEB_MODULE" version="4"> <module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true"> <component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$" />
<excludeFolder url="file://$MODULE_DIR$/dist" /> <orderEntry type="inheritedJdk" />
</content>
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment