Commit 20a02e96 authored by rockyl's avatar rockyl

修复scale找不到的问题

parent d6398ae8
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
"rollup-plugin-progress": "^1.1.2" "rollup-plugin-progress": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {
"dts-bundle": "^0.7.3",
"dts-bundle-generator": "^4.3.0", "dts-bundle-generator": "^4.3.0",
"glob": "^7.1.6", "glob": "^7.1.6",
"rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-commonjs": "^10.1.0",
...@@ -22,7 +21,6 @@ ...@@ -22,7 +21,6 @@
"typescript": "^2.7.2" "typescript": "^2.7.2"
}, },
"scripts": { "scripts": {
"declare": "node scripts/declare.js src/index.ts",
"dev": "rollup -c -m -w", "dev": "rollup -c -m -w",
"build": "rollup -c -o dist/engine.js", "build": "rollup -c -o dist/engine.js",
"build:prod": "rollup -c -o dist/engine.min.js --environment BUILD:production", "build:prod": "rollup -c -o dist/engine.min.js --environment BUILD:production",
......
...@@ -510,6 +510,9 @@ export class DisplayObject extends EventDispatcher { ...@@ -510,6 +510,9 @@ export class DisplayObject extends EventDispatcher {
* @member {Point|ObservablePoint} * @member {Point|ObservablePoint}
*/ */
get scale() { get scale() {
if(this.destroyed){
return 1;
}
return this.transform.scale; return this.transform.scale;
} }
......
import { ALIGN_MODE, AUTO_SIZE_MODE } from "./auto-adjust"; import {ALIGN_MODE, AUTO_SIZE_MODE} from "./auto-adjust";
import { toBoolean } from "../utils/utils"; import {toBoolean} from "../utils/utils";
import { Container } from "../../2d/display/index"; import {Container} from "../../2d/display/index";
/** /**
* 自适应管理器 * 自适应管理器
...@@ -23,12 +23,18 @@ class AlignManager { ...@@ -23,12 +23,18 @@ class AlignManager {
const list = this.alignList; const list = this.alignList;
list.forEach((v: Container) => { list.forEach((v: Container) => {
if(v.destroyed){
return;
}
this.autoSize(v); // 去调整大小 this.autoSize(v); // 去调整大小
this.align(v); // 去自动对齐 this.align(v); // 去自动对齐
}); });
// 要在这里单独检查,因为对齐一次后可能遇到其父节点需要对齐导致其再对齐一次 // 要在这里单独检查,因为对齐一次后可能遇到其父节点需要对齐导致其再对齐一次
list.forEach((v) => { list.forEach((v) => {
if(v.destroyed){
return;
}
if (v.alignMode === ALIGN_MODE.ONCE) { // 如果是单次对齐则一次运算之后就关闭它 if (v.alignMode === ALIGN_MODE.ONCE) { // 如果是单次对齐则一次运算之后就关闭它
v.alignEnabled = false; v.alignEnabled = false;
} }
...@@ -91,9 +97,9 @@ class AlignManager { ...@@ -91,9 +97,9 @@ class AlignManager {
} else { } else {
// 先设置下自己的 width // 先设置下自己的 width
if(toBoolean(percentWidth)){ if (toBoolean(percentWidth)) {
tW_Z = that.width = pW_Z * percentWidth / 100 tW_Z = that.width = pW_Z * percentWidth / 100
}else{ } else {
tW_Z = that.width; tW_Z = that.width;
} }
...@@ -124,9 +130,9 @@ class AlignManager { ...@@ -124,9 +130,9 @@ class AlignManager {
} else { } else {
// 先设置下自己的 height // 先设置下自己的 height
if(toBoolean(percentHeight)){ if (toBoolean(percentHeight)) {
tH_Z = that.height = pH_Z * percentHeight / 100 tH_Z = that.height = pH_Z * percentHeight / 100
}else{ } else {
tH_Z = that.height; tH_Z = that.height;
} }
...@@ -145,7 +151,7 @@ class AlignManager { ...@@ -145,7 +151,7 @@ class AlignManager {
} }
} }
if(that.children){ if (that.children) {
that.children.forEach(v => this.align(v)); that.children.forEach(v => this.align(v));
} }
} }
...@@ -155,7 +161,7 @@ class AlignManager { ...@@ -155,7 +161,7 @@ class AlignManager {
* @param that * @param that
*/ */
private autoSize(that) { private autoSize(that) {
if(!that.children){ if (!that.children) {
return; return;
} }
const len = that.children.length const len = that.children.length
......
...@@ -151,7 +151,6 @@ export class GameStage extends Node { ...@@ -151,7 +151,6 @@ export class GameStage extends Node {
start() { start() {
const {options: {entrySceneView,},} = this._config; const {options: {entrySceneView,},} = this._config;
setTimeout(async () => { setTimeout(async () => {
let sceneEntry = await this.instantiateView(entrySceneView); let sceneEntry = await this.instantiateView(entrySceneView);
if (sceneEntry) { if (sceneEntry) {
......
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