We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
现在我是用一个 createstage.js 来创建舞台,再index.js中引入 createstage.js
import {Scene} from 'spritejs'; console.log('in frame window height:' + window.innerHeight); window.onload = function(){ console.log('out frame window onloaded height:' + window.innerHeight); } const stage = new Scene('#stage', { viewport: [750, 1334-110], resolution: [750,1334-110], stickMode: '', stickExtend :true, } ); const stageprop = { width:stage.resolution[0], height:stage.resolution[1], }; export {stage,stageprop}
这样在场景页面我就能通过stageprop拿到场景的宽高,但是这个宽高其实是设计宽高,手机实际宽高window.innerHeight需要在window.onload里面拿的才是真实的,所以我想问有没有解决方法在window.onload之后再创建舞台?
The text was updated successfully, but these errors were encountered:
有一个想法是 通过创建对象,这个对象包含init() 和 stage和stageprop,init()之后才创建舞台,然后导出的是这个对象,但是这样做的话我好想所有页面的 stage.layer('xxx')都要改掉...
Sorry, something went wrong.
你在window.onload之后再new Scene,或者你先执行了,等window.onload的时候重新设一下scene的viewport
window.onload = function() { scene.viewport = [window.innerWidth, window.innerHeight]; scene.resolution = [window.innerWidth, window.innerHeight]; }
@akira-cn 知道了!谢谢!
No branches or pull requests
现在我是用一个 createstage.js 来创建舞台,再index.js中引入 createstage.js
这样在场景页面我就能通过stageprop拿到场景的宽高,但是这个宽高其实是设计宽高,手机实际宽高window.innerHeight需要在window.onload里面拿的才是真实的,所以我想问有没有解决方法在window.onload之后再创建舞台?
The text was updated successfully, but these errors were encountered: