Selaa lähdekoodia

Add container to simple-bottom-buttons, minor example fixes.

master
Palash Bansal 2 vuotta sitten
vanhempi
commit
b5f0506623
No account linked to committer's email address

+ 2
- 2
examples/examples-utils/simple-bottom-buttons.ts Näytä tiedosto

@@ -1,4 +1,4 @@
export function createSimpleButtons(buttons: Record<string, (btn: HTMLButtonElement) => void>) {
export function createSimpleButtons(buttons: Record<string, (btn: HTMLButtonElement) => void>, container = document.body) {
const entries = Object.entries(buttons)
entries.forEach(([text, onclick], i) => {
const btn = document.createElement('button')
@@ -8,6 +8,6 @@ export function createSimpleButtons(buttons: Record<string, (btn: HTMLButtonElem
btn.style.right = '3rem'
btn.style.zIndex = '10000'
btn.onclick = async() => onclick(btn)
document.body.appendChild(btn)
container.appendChild(btn)
})
}

+ 1
- 1
examples/extra-importer-plugins/index.html Näytä tiedosto

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Extra importer plugins</title>
<title>Extra Importer Plugins</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Import maps polyfill -->
<!-- Remove this when import maps will be widely supported -->

+ 1
- 2
examples/extra-importer-plugins/script.ts Näytä tiedosto

@@ -78,13 +78,12 @@ async function init() {
autoScaleRadius: 0.5,
clearSceneObjects: false,
}
let i = 0
const models = await Promise.allSettled(urls.map(async url =>
viewer.load<IObject3D>(url, options).then(res => {
if (!res) return
const i = urls.indexOf(url)
res.position.set(i % 4 - 1.5, 0, Math.floor(i / 4) - 1.5).multiplyScalar(1)
res.setDirty()
i++
return res
})))


+ 2
- 2
examples/fullscreen-plugin/script.ts Näytä tiedosto

@@ -16,12 +16,12 @@ async function init() {
createSimpleButtons({
['Enter/Exit fullscreen']: () => {
if (fullScreenPlugin.isFullScreen()) fullScreenPlugin.exit()
else fullScreenPlugin.enter(document.body) // parameter is optional, if not specified, the viewer canvas will be used
else fullScreenPlugin.enter(viewer.container) // parameter is optional, if not specified, the viewer canvas will be used

// or just use
// fullScreenPlugin.toggle(document.body)
},
})
}, viewer.container)


const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true))

+ 1
- 1
examples/geometry-uv-preview/index.html Näytä tiedosto

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Render Target Preview</title>
<title>Geometry UV Preview</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Import maps polyfill -->
<!-- Remove this when import maps will be widely supported -->

+ 1
- 1
examples/normal-buffer-plugin/index.html Näytä tiedosto

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Depth Buffer Plugin</title>
<title>Normal Buffer Plugin</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Import maps polyfill -->
<!-- Remove this when import maps will be widely supported -->

Loading…
Peruuta
Tallenna