feat: replace dialog with toast

main
Yu Zhu 2023-04-03 05:58:00 +08:00
parent 75665f5a47
commit 591eaa28c5
9 changed files with 28 additions and 23 deletions

View File

@ -75,12 +75,7 @@ const MenubarDemo: React.FC<{
<Menubar.Item
className={MenubarItem}
onSelect={() => {
const url = editor.GenerateSceneURL()
ShowDialog({
title: 'URL',
description: url,
button: 'OK',
})
helper.GenerateSceneURL()
}}
>
{i18n.t('Generate Scene URL')}

View File

@ -1471,17 +1471,6 @@ void main() {
}
}
GenerateSceneURL() {
try {
const d = encodeURIComponent(JSON.stringify(this.GetSceneData()))
const url_base = location.href.replace(/#$/, '')
return `${url_base}#${d}`
} catch (error) {
console.error(error)
}
return null
}
ClearScene() {
this.scene.children
.filter((o) => o?.name === 'torso')

View File

@ -83,6 +83,22 @@ export class Helper {
return null
}
}
async GenerateSceneURL() {
try {
const d = encodeURIComponent(
JSON.stringify(this.editor.GetSceneData())
)
const url_base = location.href.replace(/#$/, '')
const url = `${url_base}#${d}`
await navigator.clipboard.writeText(url)
ShowToast({ title: i18n.t('Copied to Clipboard') })
} catch (error) {
Oops(error)
console.error(error)
}
}
async SetRandomPose() {
const body = await this.editor.GetBodyToSetPose()
if (!body) {

View File

@ -60,5 +60,6 @@
"Lock View": "Ansicht sperren",
"Unlock View": "Ansicht entsperren",
"Copy Keypoint Data": "Schlüsselpunktdaten kopieren",
"Copied to Clipboard": "In die Zwischenablage kopiert"
"Copied to Clipboard": "In die Zwischenablage kopiert",
"Generate Scene URL": "Szene-URL generieren"
}

View File

@ -60,5 +60,6 @@
"Lock View": "Bloquear vista",
"Unlock View": "Desbloquear vista",
"Copy Keypoint Data": "Copiar datos del punto clave",
"Copied to Clipboard": "Copiado al portapapeles"
"Copied to Clipboard": "Copiado al portapapeles",
"Generate Scene URL": "Generar URL de escena"
}

View File

@ -60,5 +60,6 @@
"Lock View": "锁定视图",
"Unlock View": "解除锁定视图",
"Copy Keypoint Data": "复制关键点数据",
"Copied to Clipboard": "已复制到剪贴板"
"Copied to Clipboard": "已复制到剪贴板",
"Generate Scene URL": "生成场景URL"
}

View File

@ -60,5 +60,6 @@
"Lock View": "鎖定視圖",
"Unlock View": "解鎖視圖",
"Copy Keypoint Data": "複製關鍵點數據",
"Copied to Clipboard": "已複製到剪貼板"
"Copied to Clipboard": "已複製到剪貼板",
"Generate Scene URL": "生成場景URL"
}

View File

@ -60,5 +60,6 @@
"Lock View": "鎖定視圖",
"Unlock View": "解鎖視圖",
"Copy Keypoint Data": "複製關鍵點數據",
"Copied to Clipboard": "已複製到剪貼板"
"Copied to Clipboard": "已複製到剪貼板",
"Generate Scene URL": "生成場景URL"
}

View File

@ -42,7 +42,7 @@ const config: UserConfigFn = ({ command, mode, ssrBuild }) => {
base: mode === 'singlefile' ? './' : '/open-pose-editor/',
define: {
global: {},
__APP_VERSION__: JSON.stringify('0.1.7'),
__APP_VERSION__: JSON.stringify('0.1.8'),
__APP_BUILD_TIME__: Date.now(),
},
build: {