Commit 9e4545ad authored by rockyl's avatar rockyl

增加全舞台尺寸适配组件

parent f1502810
......@@ -48,8 +48,6 @@ export default class CameraController extends ScillaComponent {
const {width, height} = this.stageSize;
const {x, y} = this.viewportAnchor;
this.transform.position.setXY(width * x, height * y);
this.transform.width = width;
this.transform.height = height;
}
}
......
/**
* Created by rockyl on 2018/11/15.
*
*/
import {getStageSize, ScillaComponent, } from "scilla";
/**
* 全舞台尺寸组件
*/
export default class FullStageSize extends ScillaComponent {
once: boolean = true;
private stageSize;
onCreate() {
super.onCreate();
}
onAwake() {
super.onAwake();
this.stageSize = getStageSize();
this.execute();
}
onUpdate(t) {
super.onUpdate(t);
if(!this.once){
this.execute();
}
}
execute() {
const {width, height} = this.stageSize;
this.transform.width = width;
this.transform.height = height;
}
}
......@@ -5,3 +5,4 @@
export {default as CameraController} from './CameraController'
export {default as ContentSizeFitter} from './ContentSizeFitter'
export {default as RelativeLayout} from './RelativeLayout'
export {default as FullStageSize} from './FullStageSize'
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