Commit 6a30b259 authored by rockyl's avatar rockyl

修复批量弹窗问题

parent c26351a8
...@@ -15178,7 +15178,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -15178,7 +15178,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}); });
Object.defineProperty(TextField.prototype, "shadowBlur", { Object.defineProperty(TextField.prototype, "shadowBlur", {
get: function () { get: function () {
return this._shadowColor; return this._shadowBlur;
}, },
set: function (value) { set: function (value) {
if (this._shadowBlur != value) { if (this._shadowBlur != value) {
...@@ -17054,7 +17054,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -17054,7 +17054,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
.to(outPos, duration, Ease[outEase]) .to(outPos, duration, Ease[outEase])
.call(function () { .call(function () {
container.removeChild(lastView); container.removeChild(lastView);
injectProp(lastView, outPos); injectProp(lastView, { scaleX: 1, scaleY: 1 });
callback(); callback();
}); });
} }
...@@ -17069,8 +17069,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -17069,8 +17069,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
y: view.y, y: view.y,
scaleX: 1, scaleY: 1 scaleX: 1, scaleY: 1
}; };
view.anchorX = view.width / 2;
view.anchorY = view.height / 2;
outPos.x -= view.width / 2; outPos.x -= view.width / 2;
outPos.y -= view.height / 2; outPos.y -= view.height / 2;
view.visible = true; view.visible = true;
...@@ -17078,6 +17076,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -17078,6 +17076,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Tween.get(view, null, null, true) Tween.get(view, null, null, true)
.to(inPos, duration, Ease[inEase]) .to(inPos, duration, Ease[inEase])
.call(function () { .call(function () {
view.anchorX = 0;
view.anchorY = 0;
callback(); callback();
}); });
} }
...@@ -17109,7 +17109,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -17109,7 +17109,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
.to({ scaleX: 0, scaleY: 0 }, duration, Ease[outEase]) .to({ scaleX: 0, scaleY: 0 }, duration, Ease[outEase])
.call(function () { .call(function () {
container.removeChild(lastView); container.removeChild(lastView);
injectProp(view, { scaleX: 0, scaleY: 0 }); injectProp(view, { scaleX: 1, scaleY: 1 });
callback(); callback();
}); });
} }
...@@ -17126,6 +17126,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -17126,6 +17126,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Tween.get(view, null, null, true) Tween.get(view, null, null, true)
.to({ scaleX: 1, scaleY: 1 }, duration, Ease[inEase]) .to({ scaleX: 1, scaleY: 1 }, duration, Ease[inEase])
.call(function () { .call(function () {
view.anchorX = 0;
view.anchorY = 0;
callback(); callback();
}); });
} }
...@@ -17135,6 +17137,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -17135,6 +17137,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
} }
}, },
}; };
//# sourceMappingURL=view-effects.js.map
var StackContainer = (function (_super) { var StackContainer = (function (_super) {
tslib_1.__extends(StackContainer, _super); tslib_1.__extends(StackContainer, _super);
...@@ -17144,6 +17147,25 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -17144,6 +17147,25 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var _this = _super.call(this) || this; var _this = _super.call(this) || this;
_this._stack = []; _this._stack = [];
_this._inserted = 0; _this._inserted = 0;
_this._playing = false;
_this._actionQueue = [];
_this._playNextAction = function () {
if (_this._playing || _this._actionQueue.length === 0) {
return;
}
var actionItem = _this._actionQueue.shift();
var args = [];
for (var i = 0, li = actionItem.args.length; i < li; i++) {
var argument = actionItem.args[i];
args.push(argument);
}
_this._playing = true;
_this['_' + actionItem.action].apply(_this, args)
.then(function () {
_this._playing = false;
setTimeout(_this._playNextAction, 1);
});
};
_this._mutex = mutex; _this._mutex = mutex;
_this._inserted = inserted; _this._inserted = inserted;
_this.percentWidth = 100; _this.percentWidth = 100;
...@@ -17165,91 +17187,117 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -17165,91 +17187,117 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
enumerable: true, enumerable: true,
configurable: true configurable: true
}); });
StackContainer.prototype.push = function (view, options, playEffect, callback) { StackContainer.prototype.push = function (view, options, playEffect) {
var _this = this;
if (playEffect === void 0) { playEffect = true; } if (playEffect === void 0) { playEffect = true; }
var action = 'push'; this._actionQueue.push({ action: 'push', args: arguments });
var lastView; this._playNextAction();
if (this._mutex && this.childNum > 0) {
lastView = this.getChildAt(0);
this._stack.push(lastView);
}
view.visible = false;
this.addChild(view);
var data = { action: action, view: view, lastView: lastView, options: options, hasView: true };
this.dispatchEvent(Event.START, data);
playViewEffect(playEffect ? options ? options.effect : null : null, options ? options.effectParams : {}, this._mutex, lastView, view, this, function () {
_this.dispatchEvent(Event.COMPLETE, data);
callback && callback();
});
}; };
StackContainer.prototype.pop = function (options, playEffect, callback) { StackContainer.prototype.pop = function (options, playEffect) {
if (playEffect === void 0) { playEffect = true; }
this._actionQueue.push({ action: 'pop', args: arguments });
this._playNextAction();
};
StackContainer.prototype.replace = function (view, options, playEffect) {
if (playEffect === void 0) { playEffect = true; }
this._actionQueue.push({ action: 'replace', args: arguments });
this._playNextAction();
};
StackContainer.prototype.popAll = function (view, options, playEffect) {
if (playEffect === void 0) { playEffect = true; }
this._actionQueue.push({ action: 'popAll', args: arguments });
this._playNextAction();
};
StackContainer.prototype._push = function (view, options, playEffect) {
var _this = this; var _this = this;
if (playEffect === void 0) { playEffect = true; } if (playEffect === void 0) { playEffect = true; }
var action = 'pop'; return new Promise(function (resolve) {
var len = this.childNum; var action = 'push';
if (len <= 0) { var lastView;
return false; if (_this._mutex && _this.childNum > 0) {
} lastView = _this.getChildAt(0);
var lastView = this.getChildAt(this.children.length - 1); _this._stack.push(lastView);
var view; }
if (this._mutex) {
view = this._stack.pop();
view.visible = false; view.visible = false;
this.addChild(view); _this.addChild(view);
} var data = { action: action, view: view, lastView: lastView, options: options, hasView: true };
var data = { action: action, view: view, lastView: lastView, options: options, hasView: len > 1 }; _this.dispatchEvent(Event.START, data);
this.dispatchEvent(Event.START, data); playViewEffect(playEffect ? options ? options.effect : null : null, options ? options.effectParams : {}, _this._mutex, lastView, view, _this, function () {
playViewEffect(playEffect ? options ? options.effect : null : null, options ? options.effectParams : {}, this._mutex, lastView, view, this, function () { _this.dispatchEvent(Event.COMPLETE, data);
_this.dispatchEvent(Event.COMPLETE, data); resolve();
callback && callback(); });
}); });
return true;
}; };
StackContainer.prototype.replace = function (view, options, playEffect, callback) { StackContainer.prototype._pop = function (options, playEffect) {
var _this = this; var _this = this;
if (playEffect === void 0) { playEffect = true; } if (playEffect === void 0) { playEffect = true; }
var action = 'replace'; return new Promise(function (resolve) {
var len = this.childNum; var action = 'pop';
if (len <= 0) { var len = _this.childNum;
return false; if (len <= 0) {
} return false;
var lastView = this.getChildAt(len - 1); }
view.visible = false; var lastView = _this.getChildAt(_this.children.length - 1);
this.addChild(view); var view;
var data = { action: action, view: view, lastView: lastView, options: options, hasView: len > 1 }; if (_this._mutex) {
this.dispatchEvent(Event.START, data); view = _this._stack.pop();
playViewEffect(playEffect ? options ? options.effect : null : null, options ? options.effectParams : {}, this._mutex, lastView, view, this, function () { view.visible = false;
_this.dispatchEvent(Event.COMPLETE, data); _this.addChild(view);
callback && callback(); }
var data = { action: action, view: view, lastView: lastView, options: options, hasView: len > 1 };
_this.dispatchEvent(Event.START, data);
playViewEffect(playEffect ? options ? options.effect : null : null, options ? options.effectParams : {}, _this._mutex, lastView, view, _this, function () {
_this.dispatchEvent(Event.COMPLETE, data);
resolve();
});
}); });
}; };
StackContainer.prototype.popAll = function (view, options, playEffect, callback) { StackContainer.prototype._replace = function (view, options, playEffect) {
var _this = this; var _this = this;
if (playEffect === void 0) { playEffect = true; } if (playEffect === void 0) { playEffect = true; }
var action = 'popAll'; return new Promise(function (resolve) {
var lastView = this.getChildAt(0); var action = 'replace';
var len = this.childNum; var len = _this.childNum;
while (this.children.length > 1) { if (len <= 0) {
this.removeChildAt(1); return false;
} }
if (this._mutex) { var lastView = _this.getChildAt(len - 1);
this._stack.splice(0);
}
if (view) {
view.visible = false; view.visible = false;
this.addChild(view); _this.addChild(view);
} var data = { action: action, view: view, lastView: lastView, options: options, hasView: len > 1 };
var data = { action: action, view: view, lastView: lastView, options: options, hasView: len > 1 }; _this.dispatchEvent(Event.START, data);
this.dispatchEvent(Event.START, data); playViewEffect(playEffect ? options ? options.effect : null : null, options ? options.effectParams : {}, _this._mutex, lastView, view, _this, function () {
playViewEffect(playEffect ? options ? options.effect : null : null, options ? options.effectParams : {}, this._mutex, lastView, view, this, function () { _this.dispatchEvent(Event.COMPLETE, data);
_this.dispatchEvent(Event.COMPLETE, data); resolve();
callback && callback(); });
});
};
StackContainer.prototype._popAll = function (view, options, playEffect) {
var _this = this;
if (playEffect === void 0) { playEffect = true; }
return new Promise(function (resolve) {
var action = 'popAll';
var lastView = _this.getChildAt(0);
var len = _this.childNum;
while (_this.children.length > 1) {
_this.removeChildAt(1);
}
if (_this._mutex) {
_this._stack.splice(0);
}
if (view) {
view.visible = false;
_this.addChild(view);
}
var data = { action: action, view: view, lastView: lastView, options: options, hasView: len > 1 };
_this.dispatchEvent(Event.START, data);
playViewEffect(playEffect ? options ? options.effect : null : null, options ? options.effectParams : {}, _this._mutex, lastView, view, _this, function () {
_this.dispatchEvent(Event.COMPLETE, data);
resolve();
});
}); });
}; };
return StackContainer; return StackContainer;
}(Node$1)); }(Node$1));
//# sourceMappingURL=StackContainer.js.map
var colorName = { var colorName = {
"aliceblue": [240, 248, 255], "aliceblue": [240, 248, 255],
...@@ -21002,9 +21050,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -21002,9 +21050,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
switch (_e.label) { switch (_e.label) {
case 0: case 0:
_a = this._config, assets = _a.assets, customs = _a.customs; _a = this._config, assets = _a.assets, customs = _a.customs;
if (Array.isArray(assets)) { if (!!Array.isArray(assets)) return [3, 4];
return [2];
}
_b = []; _b = [];
for (_c in assets) for (_c in assets)
_b.push(_c); _b.push(_c);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{"id":"engine","url":"engine.064186f5e8dcc18d3c38e8e0526e183be57587f2.js"} {"id":"engine","url":"engine.50f2306185a286c24568fc87ef21dd4070b56456.js"}
\ No newline at end of file \ No newline at end of file
...@@ -15,6 +15,9 @@ export class StackContainer extends Node { ...@@ -15,6 +15,9 @@ export class StackContainer extends Node {
private _stack = []; private _stack = [];
private _inserted = 0; private _inserted = 0;
private _playing = false;
private _actionQueue = [];
constructor(mutex = true, inserted = 0) { constructor(mutex = true, inserted = 0) {
super(); super();
...@@ -43,66 +46,20 @@ export class StackContainer extends Node { ...@@ -43,66 +46,20 @@ export class StackContainer extends Node {
* @param view * @param view
* @param options * @param options
* @param playEffect * @param playEffect
* @param callback
*/ */
push(view: DisplayObject, options?, playEffect = true, callback?) { push(view: DisplayObject, options?, playEffect = true) {
const action = 'push'; this._actionQueue.push({action: 'push', args: arguments});
this._playNextAction();
let lastView;
if (this._mutex && this.childNum > 0) {
lastView = this.getChildAt(0);
this._stack.push(lastView);
}
view.visible = false;
this.addChild(view);
let data = {action, view, lastView, options, hasView: true};
this.dispatchEvent(Event.START, data);
playViewEffect(
playEffect ? options ? options.effect : null : null,
options ? options.effectParams : {},
this._mutex, lastView, view, this,
() => {
this.dispatchEvent(Event.COMPLETE, data);
callback && callback();
}
)
} }
/** /**
* 撤出视图 * 撤出视图
* @param options * @param options
* @param playEffect * @param playEffect
* @param callback
*/ */
pop(options?, playEffect = true, callback?) { pop(options?, playEffect = true) {
const action = 'pop'; this._actionQueue.push({action: 'pop', args: arguments});
this._playNextAction();
let len = this.childNum;
if (len <= 0) {
return false;
}
let lastView = this.getChildAt(this.children.length - 1);
let view;
if (this._mutex) {
view = this._stack.pop();
view.visible = false;
this.addChild(view);
}
let data = {action, view, lastView, options, hasView: len > 1};
this.dispatchEvent(Event.START, data);
playViewEffect(
playEffect ? options ? options.effect : null : null,
options ? options.effectParams : {},
this._mutex, lastView, view, this,
() => {
this.dispatchEvent(Event.COMPLETE, data);
callback && callback();
}
);
return true;
} }
/** /**
...@@ -110,31 +67,10 @@ export class StackContainer extends Node { ...@@ -110,31 +67,10 @@ export class StackContainer extends Node {
* @param view * @param view
* @param options * @param options
* @param playEffect * @param playEffect
* @param callback
*/ */
replace(view: DisplayObject, options?, playEffect = true, callback?) { replace(view: DisplayObject, options?, playEffect = true) {
const action = 'replace'; this._actionQueue.push({action: 'replace', args: arguments});
this._playNextAction();
let len = this.childNum;
if (len <= 0) {
return false;
}
let lastView = this.getChildAt(len - 1);
view.visible = false;
this.addChild(view);
let data = {action, view, lastView, options, hasView: len > 1};
this.dispatchEvent(Event.START, data);
playViewEffect(
playEffect ? options ? options.effect : null : null,
options ? options.effectParams : {},
this._mutex, lastView, view, this,
() => {
this.dispatchEvent(Event.COMPLETE, data);
callback && callback();
}
)
} }
/** /**
...@@ -142,35 +78,144 @@ export class StackContainer extends Node { ...@@ -142,35 +78,144 @@ export class StackContainer extends Node {
* @param view * @param view
* @param options * @param options
* @param playEffect * @param playEffect
* @param callback
*/ */
popAll(view?: DisplayObject, options?, playEffect = true, callback?) { popAll(view?: DisplayObject, options?, playEffect = true) {
const action = 'popAll'; this._actionQueue.push({action: 'popAll', args: arguments});
this._playNextAction();
}
let lastView = this.getChildAt(0); private _playNextAction = () => {
let len = this.childNum; if (this._playing || this._actionQueue.length === 0) {
while (this.children.length > 1) { return;
this.removeChildAt(1);
} }
if (this._mutex) {
this._stack.splice(0); let actionItem = this._actionQueue.shift();
let args = [];
for (let i = 0, li = actionItem.args.length; i < li; i++) {
const argument = actionItem.args[i];
args.push(argument);
} }
this._playing = true;
this['_' + actionItem.action].apply(this, args)
.then(()=>{
this._playing = false;
setTimeout(this._playNextAction, 1);
});
};
private _push(view: DisplayObject, options?, playEffect = true) {
return new Promise(resolve => {
const action = 'push';
let lastView;
if (this._mutex && this.childNum > 0) {
lastView = this.getChildAt(0);
this._stack.push(lastView);
}
view.visible = false;
this.addChild(view);
let data = {action, view, lastView, options, hasView: true};
this.dispatchEvent(Event.START, data);
playViewEffect(
playEffect ? options ? options.effect : null : null,
options ? options.effectParams : {},
this._mutex, lastView, view, this,
() => {
this.dispatchEvent(Event.COMPLETE, data);
resolve();
}
)
})
}
private _pop(options?, playEffect = true) {
return new Promise(resolve => {
const action = 'pop';
let len = this.childNum;
if (len <= 0) {
return false;
}
let lastView = this.getChildAt(this.children.length - 1);
let view;
if (this._mutex) {
view = this._stack.pop();
view.visible = false;
this.addChild(view);
}
let data = {action, view, lastView, options, hasView: len > 1};
this.dispatchEvent(Event.START, data);
playViewEffect(
playEffect ? options ? options.effect : null : null,
options ? options.effectParams : {},
this._mutex, lastView, view, this,
() => {
this.dispatchEvent(Event.COMPLETE, data);
resolve();
}
)
})
}
private _replace(view: DisplayObject, options?, playEffect = true) {
return new Promise(resolve => {
const action = 'replace';
let len = this.childNum;
if (len <= 0) {
return false;
}
let lastView = this.getChildAt(len - 1);
if(view){
view.visible = false; view.visible = false;
this.addChild(view); this.addChild(view);
}
let data = {action, view, lastView, options, hasView: len > 1}; let data = {action, view, lastView, options, hasView: len > 1};
this.dispatchEvent(Event.START, data); this.dispatchEvent(Event.START, data);
playViewEffect( playViewEffect(
playEffect ? options ? options.effect : null : null, playEffect ? options ? options.effect : null : null,
options ? options.effectParams : {}, options ? options.effectParams : {},
this._mutex, lastView, view, this, this._mutex, lastView, view, this,
() => { () => {
this.dispatchEvent(Event.COMPLETE, data); this.dispatchEvent(Event.COMPLETE, data);
callback && callback(); resolve();
}
)
})
}
private _popAll(view?: DisplayObject, options?, playEffect = true) {
return new Promise(resolve => {
const action = 'popAll';
let lastView = this.getChildAt(0);
let len = this.childNum;
while (this.children.length > 1) {
this.removeChildAt(1);
}
if (this._mutex) {
this._stack.splice(0);
} }
)
if (view) {
view.visible = false;
this.addChild(view);
}
let data = {action, view, lastView, options, hasView: len > 1};
this.dispatchEvent(Event.START, data);
playViewEffect(
playEffect ? options ? options.effect : null : null,
options ? options.effectParams : {},
this._mutex, lastView, view, this,
() => {
this.dispatchEvent(Event.COMPLETE, data);
resolve();
}
)
})
} }
} }
\ No newline at end of file
...@@ -169,7 +169,7 @@ const effects = { ...@@ -169,7 +169,7 @@ const effects = {
.to(outPos, duration, Ease[outEase]) .to(outPos, duration, Ease[outEase])
.call(() => { .call(() => {
container.removeChild(lastView); container.removeChild(lastView);
injectProp(lastView, outPos); injectProp(lastView, {scaleX: 1, scaleY: 1});
callback(); callback();
}); });
...@@ -185,8 +185,6 @@ const effects = { ...@@ -185,8 +185,6 @@ const effects = {
y: view.y, y: view.y,
scaleX: 1, scaleY: 1 scaleX: 1, scaleY: 1
}; };
view.anchorX = view.width / 2;
view.anchorY = view.height / 2;
outPos.x -= view.width / 2; outPos.x -= view.width / 2;
outPos.y -= view.height / 2; outPos.y -= view.height / 2;
...@@ -195,6 +193,9 @@ const effects = { ...@@ -195,6 +193,9 @@ const effects = {
Tween.get(view, null, null, true) Tween.get(view, null, null, true)
.to(inPos, duration, Ease[inEase]) .to(inPos, duration, Ease[inEase])
.call(() => { .call(() => {
view.anchorX = 0;
view.anchorY = 0;
callback(); callback();
}); });
} else { } else {
...@@ -226,7 +227,7 @@ const effects = { ...@@ -226,7 +227,7 @@ const effects = {
.to({scaleX: 0, scaleY: 0}, duration, Ease[outEase]) .to({scaleX: 0, scaleY: 0}, duration, Ease[outEase])
.call(() => { .call(() => {
container.removeChild(lastView); container.removeChild(lastView);
injectProp(view, {scaleX: 0, scaleY: 0}); injectProp(view, {scaleX: 1, scaleY: 1});
callback(); callback();
}); });
...@@ -244,6 +245,8 @@ const effects = { ...@@ -244,6 +245,8 @@ const effects = {
Tween.get(view, null, null, true) Tween.get(view, null, null, true)
.to({scaleX: 1, scaleY: 1}, duration, Ease[inEase]) .to({scaleX: 1, scaleY: 1}, duration, Ease[inEase])
.call(() => { .call(() => {
view.anchorX = 0;
view.anchorY = 0;
callback(); callback();
}); });
} else { } else {
......
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