Commit 20a02e96 authored by rockyl's avatar rockyl

修复scale找不到的问题

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