Commit d44c5884 authored by haiyoucuv's avatar haiyoucuv

1

parent 192acd9f
......@@ -2,14 +2,14 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="af35c04f-08f6-48ed-85db-2f94c60e87fd" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/.idea/codeStyles/codeStyleConfig.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/debug/engine.js" beforeDir="false" afterPath="$PROJECT_DIR$/debug/engine.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/debug/engine.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/debug/engine.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/2d/display/Container.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/2d/display/Container.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/2d/display/Sprite.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/2d/display/Sprite.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/2d/text/TextField.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/2d/text/TextField.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/zeroing/game-warpper/view-effects.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/zeroing/game-warpper/view-effects.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/2d/display/Stage.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/2d/display/Stage.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/zeroing/decorators/AlignManager.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/zeroing/decorators/AlignManager.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/zeroing/decorators/auto-adjust.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/zeroing/decorators/auto-adjust.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/zeroing/launcher.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/zeroing/launcher.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -271,11 +271,11 @@
<screen x="1680" y="-229" width="1920" height="1177" />
</state>
<state x="2327" y="157" key="git4idea.merge.GitPullDialog/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1587714144888" />
<state x="2305" y="36" width="670" height="676" key="search.everywhere.popup" timestamp="1589941828855">
<state x="2305" y="36" width="670" height="676" key="search.everywhere.popup" timestamp="1589969727327">
<screen x="1680" y="-229" width="1920" height="1177" />
</state>
<state x="2305" y="18" width="670" height="690" key="search.everywhere.popup/0.0.1680.1050/1680.-252.1920.1200@1680.-252.1920.1200" timestamp="1587713287518" />
<state x="2305" y="36" width="670" height="676" key="search.everywhere.popup/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1589941828855" />
<state x="2305" y="36" width="670" height="676" key="search.everywhere.popup/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1589969727327" />
<state x="570" y="254" width="670" height="590" key="search.everywhere.popup/35.23.1645.1027/1680.-229.1920.1177@35.23.1645.1027" timestamp="1587004990635" />
<state x="570" y="254" width="670" height="590" key="search.everywhere.popup/35.23.1645.1027@35.23.1645.1027" timestamp="1589767535433" />
</component>
......
......@@ -1898,16 +1898,17 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
AlignManager.prototype.flush = function () {
var _this = this;
this.alignList.forEach(function (v) {
var list = this.alignList;
list.forEach(function (v) {
_this.autoSize(v);
_this.align(v);
});
this.alignList.forEach(function (v) {
list.forEach(function (v) {
if (v.alignMode === ALIGN_MODE.ONCE) {
v.alignEnabled = false;
}
});
this.alignList.length = 0;
list.length = 0;
};
AlignManager.prototype.align = function (that) {
var _this = this;
......@@ -1921,7 +1922,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
that.width = pW_Z - left - right;
}
else {
toBoolean(percentWidth) && (tW_Z = that.width = pW_Z * percentWidth / 100);
if (toBoolean(percentWidth)) {
tW_Z = that.width = pW_Z * percentWidth / 100;
}
if (toBoolean(horizonCenter)) {
that.x = pW_Z / 2 - tW_Z / 2 + horizonCenter;
}
......@@ -1953,7 +1956,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
AlignManager.prototype.autoSize = function (that) {
var len = that.children.length;
if (len > 0) {
if (that.autoWidth && !toBoolean(that.right) && !toBoolean(that.percentWidth)) {
if (that.autoWidth
&& !toBoolean(that.percentWidth)) {
var max = 0;
for (var i = 0; i < len; i++) {
if (toBoolean(that.children[i].right))
......@@ -1966,7 +1970,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
that.width = max;
}
if (that.autoHeight && !toBoolean(that.bottom) && !toBoolean(that.percentHeight)) {
if (that.autoHeight
&& !toBoolean(that.percentHeight)) {
var max = 0;
for (var i = 0; i < len; i++) {
if (toBoolean(that.children[i].bottom))
......@@ -1982,8 +1987,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
};
AlignManager.prototype.addAlign = function (obj) {
if (this.alignList.indexOf(obj) < 0) {
this.alignList.push(obj);
var list = this.alignList;
if (list.indexOf(obj) < 0) {
list.push(obj);
}
};
return AlignManager;
......@@ -2051,6 +2057,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
bottom: NaN,
horizonCenter: NaN,
verticalCenter: NaN,
autoWidth: false,
autoHeight: false,
alignEnabled: true,
alignMode: ALIGN_MODE.ALWAYS,
};
......@@ -2058,26 +2066,20 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
this.makeDirty();
}
AdjustProxy.prototype.makeDirty = function () {
this._sizeDirty = true;
this._host && alignMgr.addAlign(this._host);
this._host && this._host.parent && this._host.parent.adjustProxy.makeDirty();
};
AdjustProxy.prototype.onAddedToStage = function (e) {
this._host.addEventListener(Event.MAYBE_ALIGN, this.readyAlign, this);
this._host.addEventListener(Event.MAYBE_ALIGN, this.makeDirty, this);
};
AdjustProxy.prototype.onRemovedFromStage = function (e) {
this._host.removeEventListener(Event.MAYBE_ALIGN, this.readyAlign);
this._host.removeEventListener(Event.MAYBE_ALIGN, this.makeDirty);
};
AdjustProxy.prototype.setFrom = function (adjustProxy) {
for (var k in adjustProxy.data) {
this.data[k] = adjustProxy.data[k];
}
};
AdjustProxy.prototype.readyAlign = function (e) {
this._sizeDirty = true;
this._host && alignMgr.addAlign(this._host);
this._host && this._host.parent && this._host.parent.adjustProxy.makeDirty();
};
return AdjustProxy;
}());
......@@ -3159,8 +3161,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
_this._mouseChildren = true;
_this.__width = 0;
_this.__height = 0;
_this._autoWidth = false;
_this._autoHeight = false;
_this._instanceType = "Container";
_this.children = [];
_this._transform = _this.transform;
......@@ -3589,13 +3589,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN);
if (toBoolean(this.percentWidth)
|| (toBoolean(this.left) && toBoolean(this.right))) {
this.__width = 0;
}
else {
this.__width = value;
}
this.__width = (toBoolean(this.percentWidth) || (toBoolean(this.left) && toBoolean(this.right)))
? 0
: value;
}
},
enumerable: true,
......@@ -3617,44 +3613,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN);
if (toBoolean(this.percentHeight)
|| (toBoolean(this.top) && toBoolean(this.bottom))) {
this.__height = 0;
}
else {
this.__height = value;
}
this.__height = (toBoolean(this.percentHeight) || (toBoolean(this.top) && toBoolean(this.bottom)))
? 0
: value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Container.prototype, "autoWidth", {
get: function () {
return this._autoWidth;
},
set: function (autoWidth) {
this._autoWidth = autoWidth;
this.right = NaN;
this.percentWidth = NaN;
this.adjustProxy.makeDirty();
},
enumerable: true,
configurable: true
});
Object.defineProperty(Container.prototype, "autoHeight", {
get: function () {
return this._autoHeight;
},
set: function (autoHeight) {
this._autoHeight = autoHeight;
this.bottom = NaN;
this.percentHeight = NaN;
this.adjustProxy.makeDirty();
},
enumerable: true,
configurable: true
});
Object.defineProperty(Container.prototype, "x", {
get: function () {
return this.position.x;
......@@ -8510,7 +8476,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Stage.flushAll = function () {
if (!GlobalPro.startTime)
GlobalPro.startTime = Date.now();
alignMgr.flush();
if (!Stage._pause) {
var len = Stage.allUpdateObjList.length;
for (var i = 0; i < len; i++) {
......@@ -21588,6 +21553,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var stage = window['stage'] = new Stage(containerId || "game-container", designWidth || 750, designHeight || 1334, frameRate || 60, scaleMode || StageScaleMode.FIXED_WIDTH, rendererType || exports.RENDERER_TYPE.WEBGL, true, bgColor, autoResize);
initAutoLayout(stage);
Stage.flushAll();
Stage.addUpdateObj(alignMgr);
stage.addEventListener(Event.ON_INIT_STAGE, function () {
exports.gameStage = new GameStage(stage);
setGlobalContext({
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -735,13 +735,9 @@ export default class Container extends DisplayObject {
this.dispatchEvent(Event.MAYBE_ALIGN);
// 如果它设置了 percentWidth 或同时设置了 left 和 right 则表示他的宽度是相对的,则对于父级来说它的宽度永远是 0
if (toBoolean(this.percentWidth)
|| (toBoolean(this.left) && toBoolean(this.right))
) {
this.__width = 0;
} else {
this.__width = value;
}
this.__width = (toBoolean(this.percentWidth) || (toBoolean(this.left) && toBoolean(this.right)))
? 0
: value;
}
}
......@@ -774,43 +770,38 @@ export default class Container extends DisplayObject {
this.dispatchEvent(Event.MAYBE_ALIGN);
// 如果它设置了 percentHeight 或同时设置了 top 和 bottom 则表示他的高度是相对的,则对于父级来说它的高度永远是 0
if (toBoolean(this.percentHeight)
|| (toBoolean(this.top) && toBoolean(this.bottom))
) {
this.__height = 0;
} else {
this.__height = value;
}
this.__height = (toBoolean(this.percentHeight) || (toBoolean(this.top) && toBoolean(this.bottom)))
? 0
: value;
}
}
protected __width = 0; // 忽略 相对宽度 的 宽度,在父级计算自动宽度的时候用到
protected __height = 0; // 忽略 相对高度 的 高度,在父级计算自动高度的时候用到
protected _autoWidth = false; // 自动宽度?
protected _autoHeight = false; // 自动高度?
public get autoWidth() {
return this._autoWidth;
}
public get autoHeight() {
return this._autoHeight;
}
/// TODO 移到了auto-dujust里
// protected _autoWidth = false; // 自动宽度?
// protected _autoHeight = false; // 自动高度?
public set autoWidth(autoWidth) {
this._autoWidth = autoWidth;
this.right = NaN; /// TODO 不知道需不需要
this.percentWidth = NaN; /// TODO 不知道需不需要
this.adjustProxy.makeDirty();
}
// public get autoWidth() {
// return this._autoWidth;
// }
//
// public get autoHeight() {
// return this._autoHeight;
// }
public set autoHeight(autoHeight) {
this._autoHeight = autoHeight;
this.bottom = NaN; /// TODO 不知道需不需要
this.percentHeight = NaN; /// TODO 不知道需不需要
this.adjustProxy.makeDirty();
}
// public set autoWidth(autoWidth) {
// if(autoWidth === this._autoWidth) return;
// this._autoWidth = autoWidth;
// this.adjustProxy.makeDirty();
// }
//
// public set autoHeight(autoHeight) {
// if(autoHeight === this._autoHeight) return;
// this._autoHeight = autoHeight;
// this.adjustProxy.makeDirty();
// }
// public judgeAutoSize() {
// this.autoWidth = !(toBoolean(this.right) || toBoolean(this.percentWidth) || toBoolean(this._width));
......
......@@ -12,7 +12,7 @@ import {WebglRenderer} from "../renderers/WebglRenderer";
import {GDispatcher} from "../events/GDispatcher";
import CanvasRenderer from "../renderers/CanvasRenderer";
import {GlobalPro, isWebGLSupported} from "../utils/index";
import { alignMgr } from "../../zeroing/decorators/AlignManager";
// import { alignMgr } from "../../zeroing/decorators/AlignManager";
//如果以后还出现帧率问题,使用ticker;
//兼容requestAnimationFrame
......@@ -972,16 +972,16 @@ export class Stage extends Container {
//记录起始时间
if (!GlobalPro.startTime) GlobalPro.startTime = Date.now();
//console.log('flushAll', Date.now());
alignMgr.flush();
if (!Stage._pause) {
let len = Stage.allUpdateObjList.length;
for (let i = 0; i < len; i++) {
Stage.allUpdateObjList[i] && Stage.allUpdateObjList[i].flush();
}
//console.log('flushAll', Date.now());
if (!Stage._pause) {
let len = Stage.allUpdateObjList.length;
for (let i = 0; i < len; i++) {
Stage.allUpdateObjList[i] && Stage.allUpdateObjList[i].flush();
}
}
requestAnimationFrame(Stage.flushAll);
// alignMgr.flush();
requestAnimationFrame(Stage.flushAll);
}
/**
......
import { ALIGN_MODE } from "./auto-adjust";
import { toBoolean } from "../utils/utils";
import { Container } from "../../2d/display/index";
/**
* 自适应管理器
......@@ -9,6 +10,9 @@ class AlignManager {
// 这个列表里的对象会在渲染前被自动调整
private alignList = [];
// private alignList1 = [];
// private listJudge = true;
constructor() {
......@@ -18,19 +22,28 @@ class AlignManager {
* flash (渲染前)
*/
public flush() {
this.alignList.forEach((v) => {
// let list = this.alignList1;
// if (this.listJudge) {
// list = this.alignList;
// }
let list = this.alignList;
list.forEach((v: Container) => {
// v.adjustProxy.resetDirty();
this.autoSize(v); // 去调整大小
this.align(v); // 去自动对齐
});
// 要在这里单独检查,因为对齐一次后可能遇到其父节点需要对齐导致其再对齐一次
this.alignList.forEach((v) => {
if(v.alignMode === ALIGN_MODE.ONCE) { // 如果是单次对齐则一次运算之后就关闭它
list.forEach((v) => {
if (v.alignMode === ALIGN_MODE.ONCE) { // 如果是单次对齐则一次运算之后就关闭它
v.alignEnabled = false;
}
});
// 干掉列表
this.alignList.length = 0;
list.length = 0;
// this.listJudge = !this.listJudge;
}
/**
......@@ -40,7 +53,7 @@ class AlignManager {
private align(that) {
// if(that)
if(!that.alignEnabled) return; // 如果的自动对齐关闭里则啥也不干
if (!that.alignEnabled) return; // 如果的自动对齐关闭里则啥也不干
// if(that.alignMode === ALIGN_MODE.ONCE) { // 如果是单次对齐则一次运算之后就关闭它
// that.alignEnabled = false;
......@@ -54,7 +67,7 @@ class AlignManager {
/**
* 计算 width 和 x 值
*/
if(toBoolean(left) && toBoolean(right)) { // left right 都有则直接拉伸或缩小
if (toBoolean(left) && toBoolean(right)) { // left right 都有则直接拉伸或缩小
that.x = left;
......@@ -62,18 +75,23 @@ class AlignManager {
} else {
// 先设置下自己的 width
toBoolean(percentWidth) && (tW_Z = that.width = pW_Z * percentWidth / 100);
// toBoolean(percentWidth) && (tW_Z = that.width = pW_Z * percentWidth / 100, isChange = true);
if (toBoolean(percentWidth)) {
tW_Z = that.width = pW_Z * percentWidth / 100;
}
// 先考虑 horizonCenter 属性
if(toBoolean(horizonCenter)) {
if (toBoolean(horizonCenter)) {
// x 值 = 父节点的中间值 - 自己宽度的一半 - 居中差值
that.x = pW_Z / 2 - tW_Z / 2 + horizonCenter;
} else if(toBoolean(left)) { // 假如有左边距
} else if (toBoolean(left)) { // 假如有左边距
that.x = left;
} else if(toBoolean(right)) { // 假如有右边距
} else if (toBoolean(right)) { // 假如有右边距
that.x = pW_Z - right - tW_Z;
......@@ -83,7 +101,7 @@ class AlignManager {
/**
* 计算 height 和 y 值
*/
if(toBoolean(top) && toBoolean(bottom)) { // top bottom 都有则直接拉伸或缩小
if (toBoolean(top) && toBoolean(bottom)) { // top bottom 都有则直接拉伸或缩小
that.y = top;
......@@ -94,15 +112,15 @@ class AlignManager {
toBoolean(percentHeight) && (tH_Z = that.height = pH_Z * percentHeight / 100);
// 先考虑 horizonCenter 属性
if(toBoolean(verticalCenter)) {
if (toBoolean(verticalCenter)) {
// x 值 = 父节点的中间值 - 自己高度的一半 - 居中差值
that.y = pH_Z / 2 - tH_Z / 2 + verticalCenter;
} else if(toBoolean(top)) { // 假如有 top
} else if (toBoolean(top)) { // 假如有 top
that.y = top;
} else if(toBoolean(bottom)) { // 假如有 bottom
} else if (toBoolean(bottom)) { // 假如有 bottom
that.y = pH_Z - bottom - tH_Z;
......@@ -120,10 +138,12 @@ class AlignManager {
private autoSize(that) {
let len = that.children.length
if(len > 0) {
if (len > 0) {
// 检测本身的是否是可以自动宽
if(that.autoWidth && !toBoolean(that.right) && !toBoolean(that.percentWidth)) {
if (that.autoWidth
// && !toBoolean(that.right) /// TODO 我把它去掉了
&& !toBoolean(that.percentWidth)) {
// 找出子节点最小x
// let minX = 0;
// for(let i = 0; i < len; i++) {
......@@ -139,11 +159,11 @@ class AlignManager {
// 找出最右值
let max = 0;
for(let i = 0; i < len; i++) {
if(toBoolean(that.children[i].right)) continue;
for (let i = 0; i < len; i++) {
if (toBoolean(that.children[i].right)) continue;
let _x = that.children[i].x || 0;
let _w = that.children[i].__width || 0;
if(_x + _w > max) {
if (_x + _w > max) {
max = _x + _w;
}
}
......@@ -151,7 +171,9 @@ class AlignManager {
}
// 检测本身的是否是可以自动高
if(that.autoHeight && !toBoolean(that.bottom) && !toBoolean(that.percentHeight)) {
if (that.autoHeight
// && !toBoolean(that.bottom) /// TODO 我把它去掉了
&& !toBoolean(that.percentHeight)) {
// 找出子节点最小y
// let minY = 0;
// for(let i = 1; i < len; i++) {
......@@ -167,11 +189,11 @@ class AlignManager {
// 找出最下值
let max = 0;
for(let i = 0; i < len; i++) {
if(toBoolean(that.children[i].bottom)) continue;
for (let i = 0; i < len; i++) {
if (toBoolean(that.children[i].bottom)) continue;
let _y = that.children[i].y || 0;
let _h = that.children[i].__height || 0;
if(_y + _h > max) {
if (_y + _h > max) {
max = _y + _h;
}
}
......@@ -185,8 +207,13 @@ class AlignManager {
* @param obj
*/
public addAlign(obj) {
if(this.alignList.indexOf(obj) < 0) {
this.alignList.push(obj);
let list = this.alignList;
// if (this.listJudge) {
// list = this.alignList1;
// }
if (list.indexOf(obj) < 0) {
list.push(obj);
}
}
}
......
......@@ -18,8 +18,8 @@ export function applyAutoAdjust(ctor: Function) {
this.addEventListener(Event.REMOVED_FROM_STAGE, adjustProxy.onRemovedFromStage, adjustProxy);
};
let temp = new AdjustProxy(null);
for(let key in temp.data) {
if(key == 'alignMode'
for (let key in temp.data) {
if (key == 'alignMode'
// || key == 'percentWidth' || key == 'percentHeight'
) continue;
......@@ -29,7 +29,7 @@ export function applyAutoAdjust(ctor: Function) {
},
set: function(v) {
const adjustProxy: AdjustProxy = this.adjustProxy;
if(adjustProxy.data[key] !== v && !(isNaN(adjustProxy.data[key]) && isNaN(v))) {
if (adjustProxy.data[key] !== v && !(isNaN(adjustProxy.data[key]) && isNaN(v))) {
adjustProxy.data[key] = v;
adjustProxy.makeDirty();
}
......@@ -79,11 +79,11 @@ export function applyAutoAdjust(ctor: Function) {
},
set: function(v) {
const adjustProxy: AdjustProxy = this.adjustProxy;
if(adjustProxy.data['alignMode'] !== v) {
if (adjustProxy.data['alignMode'] !== v) {
adjustProxy.data['alignMode'] = v;
adjustProxy.makeDirty();
if(v == ALIGN_MODE.ALWAYS) this.alignEnabled = true; // 如果设置为 always 则自动开启
if (v == ALIGN_MODE.ALWAYS) this.alignEnabled = true; // 如果设置为 always 则自动开启
}
},
enumerable: true,
......@@ -111,6 +111,9 @@ class AdjustProxy {
horizonCenter: NaN,
verticalCenter: NaN,
autoWidth:false,
autoHeight:false,
alignEnabled: true,
alignMode: ALIGN_MODE.ALWAYS,
};
......@@ -124,13 +127,18 @@ class AdjustProxy {
}
makeDirty() {
this._sizeDirty = true;
// if (this._sizeDirty) return;
// this._sizeDirty = true;
this._host && alignMgr.addAlign(this._host);
this._host && this._host.parent && this._host.parent.adjustProxy.makeDirty();
}
// resetDirty() {
// this._sizeDirty = false;
// }
onAddedToStage(e) {
this._host.addEventListener(Event.MAYBE_ALIGN, this.readyAlign, this);
this._host.addEventListener(Event.MAYBE_ALIGN, this.makeDirty, this);
// this._host.parent.addEventListener(Event.MAYBE_ALIGN, this.align, this);
// this._host.parent.addEventListener(Event.RESIZE, this.align, this);
// this._host.addEventListener(Event.RESIZE, this.align, this);
......@@ -138,7 +146,7 @@ class AdjustProxy {
}
onRemovedFromStage(e) {
this._host.removeEventListener(Event.MAYBE_ALIGN, this.readyAlign);
this._host.removeEventListener(Event.MAYBE_ALIGN, this.makeDirty);
// this._host.parent.removeEventListener(Event.MAYBE_ALIGN, this.align);
// this._host.parent.removeEventListener(Event.RESIZE, this.align);
// this._host.removeEventListener(Event.RESIZE, this.align, this);
......@@ -146,20 +154,23 @@ class AdjustProxy {
}
setFrom(adjustProxy: AdjustProxy) {
for(let k in adjustProxy.data) {
for (let k in adjustProxy.data) {
this.data[k] = adjustProxy.data[k];
}
}
/**
* align 方式 T + 1
* @param e
*/
private readyAlign(e) {
this._sizeDirty = true;
this._host && alignMgr.addAlign(this._host);
this._host && this._host.parent && this._host.parent.adjustProxy.makeDirty(); // 它爸爸也要设置一次。可能有autoSize
}
// /**
// * align 方式 T + 1
// * @param e
// */
// private readyAlign(e) {
// if (this._sizeDirty == true) {
// return;
// }
// this._sizeDirty = true;
// this._host && alignMgr.addAlign(this._host);
// this._host && this._host.parent && this._host.parent.adjustProxy.makeDirty(); // 它爸爸也要设置一次。可能有autoSize
// }
// autoSize() {
// let that = this._host.parent;
......
......@@ -70,7 +70,7 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
initAutoLayout(stage);
Stage.flushAll();
// Stage.addUpdateObj(alignMgr);
Stage.addUpdateObj(alignMgr);
stage.addEventListener(Event.ON_INIT_STAGE, () => {
gameStage = new GameStage(stage);
......
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