Skip to content
New issue

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

请教:除了ground、tree、sky,还能自己添加自定义层吗? #282

Open
826327700 opened this issue Dec 5, 2024 · 5 comments

Comments

@826327700
Copy link

如果能的话,如何添加?

@leaferjs
Copy link
Owner

leaferjs commented Dec 6, 2024

可以添加,切换一下示例代码的tab标签,有手动创建的示例,或者直接看api:

https://www.leaferjs.com/ui/reference/display/App.html#%E5%85%B3%E9%94%AE%E6%96%B9%E6%B3%95

@826327700
Copy link
Author

可以添加,切换一下示例代码的tab标签,有手动创建的示例,或者直接看api:

https://www.leaferjs.com/ui/reference/display/App.html#%E5%85%B3%E9%94%AE%E6%96%B9%E6%B3%95

app.ground = new Leafer({ type: 'draw' })
app.tree = new Leafer()
app.sky = new Leafer({ type: 'draw', usePartRender: false })

根据文档试了一下,新添加的层取名app.xxx吗?能运行,但是会报ts错误

@Ronbb
Copy link

Ronbb commented Dec 6, 2024

可以添加,切换一下示例代码的tab标签,有手动创建的示例,或者直接看api:
https://www.leaferjs.com/ui/reference/display/App.html#%E5%85%B3%E9%94%AE%E6%96%B9%E6%B3%95

app.ground = new Leafer({ type: 'draw' }) app.tree = new Leafer() app.sky = new Leafer({ type: 'draw', usePartRender: false })

根据文档试了一下,新添加的层取名app.xxx吗?能运行,但是会报ts错误

创建一个xxx.d.ts文件:

import "leafer-editor";

declare module "leafer-editor" {
  import { ILeafer } from "leafer-editor";

  interface App {
    xxx: ILeafer;
  }
}

@826327700
Copy link
Author

可以添加,切换一下示例代码的tab标签,有手动创建的示例,或者直接看api:
https://www.leaferjs.com/ui/reference/display/App.html#%E5%85%B3%E9%94%AE%E6%96%B9%E6%B3%95

app.ground = new Leafer({ type: 'draw' }) app.tree = new Leafer() app.sky = new Leafer({ type: 'draw', usePartRender: false })
根据文档试了一下,新添加的层取名app.xxx吗?能运行,但是会报ts错误

创建一个xxx.d.ts文件:

import "leafer-editor";

declare module "leafer-editor" {
  import { ILeafer } from "leafer-editor";

  interface App {
    xxx: ILeafer;
  }
}

好的 谢谢!另外问一下:

type ILeaferType =
  | 'draw' // 绘图场景
  | 'block' // 块状融入场景
  | 'editor' // 图形编辑场景
  | 'design' // 设计场景
  | 'board' // 白板场景
  | 'document' // 文档场景
  | 'app' // 应用场景
  | 'website' // 网站场景
  | 'game' // 游戏场景
  | 'player' // 动画播放场景
  | 'chart' // 图表场景
  | 'custom' // 自定义

设置不同的LeaferType有什么实际区别吗

@826327700
Copy link
Author

可以添加,切换一下示例代码的tab标签,有手动创建的示例,或者直接看api:

https://www.leaferjs.com/ui/reference/display/App.html#%E5%85%B3%E9%94%AE%E6%96%B9%E6%B3%95

当自定义新增的 new Leafer({width:xxx,height:xxx}) 设置了width和height 就不渲染在APP里了 为什么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants