主域工程代码
//显示子域
private showShareCanvas() {
Laya.timer.once(1000, this, function () {
window['sharedCanvas'].width = Laya.stage.width;
window['sharedCanvas'].height = Laya.stage.height;
var sprite = new Laya.Sprite();
sprite.zOrder = 1008;
//sprite.pos(0, 0);
var texture = new Laya.Texture(window['sharedCanvas']);
texture.bitmap.alwaysChange = true;//小程序使用,非常费
sprite.graphics.drawTexture(texture, 0, 0, texture.width, texture.height);
Laya.stage.addChild(sprite);
})
}
子域工程ui编辑时大小位置需与实际情况微调
demo下载地址:https://download.youkuaiyun.com/download/fanstasic/11454291
子域UI与主域工程整合技巧
本文介绍了一种在主域工程中显示子域UI的方法,通过调整子域UI的大小和位置来实现与主域的无缝整合。演示了如何使用Laya.timer和Laya.stage API来控制子域canvas的尺寸,并将其正确地添加到主域舞台上。
1623

被折叠的 条评论
为什么被折叠?



