Skip to content

Commit

Permalink
Merge pull request #35 from lec-org/feat-api
Browse files Browse the repository at this point in the history
fix:修复渲染器大小与挂载组件大小不符的问题👌
  • Loading branch information
CoderSerio authored Nov 5, 2023
2 parents c6c6e90 + 0d36ecf commit 15bcb9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/vue/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div ref="el" id="three"></div>
<div ref="el" id="three" style="width: 500px;height: 500px;"></div>
</template>

<script setup lang="ts">
Expand Down Expand Up @@ -102,6 +102,7 @@ onMounted(() => {
mountCss2dTo(el.value);
mountCss3dTo(el.value);
mountTo(el.value);
});
</script>
1 change: 1 addition & 0 deletions src/scene/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const init = (params: InitParams): InitReturns => {
// TODO:下述方法后续移入 utils 中, index 中做到尽量不额外创建函数
// 挂载
const mountTo = (element: HTMLElement) => {
renderer.setSize(element.offsetWidth,element.offsetHeight)
element.appendChild(renderer.domElement);
};

Expand Down

0 comments on commit 15bcb9d

Please sign in to comment.