调整模型预览下载按钮位置
This commit is contained in:
@@ -155,13 +155,12 @@ export function openModelPreview(
|
|||||||
<div class="preview-scene-section">
|
<div class="preview-scene-section">
|
||||||
<div class="preview-scene-body">
|
<div class="preview-scene-body">
|
||||||
<div class="preview-scene-actions">
|
<div class="preview-scene-actions">
|
||||||
<button id="previewImportSceneBtn" class="primary-btn" type="button">导入</button>
|
<button id="previewImportSceneBtn" class="primary-btn" type="button">导入场景</button>
|
||||||
<button id="previewDownloadBtn" type="button">下载</button>
|
|
||||||
</div>
|
|
||||||
<label class="preview-switch">
|
<label class="preview-switch">
|
||||||
<input id="previewUseBasePoint" type="checkbox" />
|
<input id="previewUseBasePoint" type="checkbox" />
|
||||||
<span>启用基点</span>
|
<span>启用基点</span>
|
||||||
</label>
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="preview-basepoint-grid">
|
<div class="preview-basepoint-grid">
|
||||||
<label><span>X</span><input name="baseX" type="number" value="0" step="0.001" /></label>
|
<label><span>X</span><input name="baseX" type="number" value="0" step="0.001" /></label>
|
||||||
@@ -182,6 +181,9 @@ export function openModelPreview(
|
|||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
actions: {
|
actions: {
|
||||||
|
下载() {
|
||||||
|
bindDownloadModel(model);
|
||||||
|
},
|
||||||
更新缩略图() {
|
更新缩略图() {
|
||||||
if (canWrite) {
|
if (canWrite) {
|
||||||
screenshotModel(model.id, onThumbnailSaved).catch((error) => {
|
screenshotModel(model.id, onThumbnailSaved).catch((error) => {
|
||||||
@@ -201,7 +203,6 @@ export function openModelPreview(
|
|||||||
console.log(popup)
|
console.log(popup)
|
||||||
bindProcessPlaceholder(operations);
|
bindProcessPlaceholder(operations);
|
||||||
bindImportScene(model, operations, options.onImportScene);
|
bindImportScene(model, operations, options.onImportScene);
|
||||||
bindDownloadModel(model);
|
|
||||||
if (canWrite) bindThumbnailCapture(model.id, onThumbnailSaved);
|
if (canWrite) bindThumbnailCapture(model.id, onThumbnailSaved);
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
initPreview(url, context).catch((error) => {
|
initPreview(url, context).catch((error) => {
|
||||||
@@ -583,14 +584,12 @@ function bindImportScene(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindDownloadModel(model: ModelItem) {
|
async function bindDownloadModel(model: ModelItem) {
|
||||||
document.querySelector<HTMLButtonElement>("#previewDownloadBtn")?.addEventListener("click", async () => {
|
try {
|
||||||
try {
|
await downloadFileFromUrl(model.file_url, model.original_filename || model.name);
|
||||||
await downloadFileFromUrl(model.file_url, model.original_filename || model.name);
|
} catch (error) {
|
||||||
} catch (error) {
|
notifyError(error);
|
||||||
notifyError(error);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveBasePoint(basePoint?: PreviewBasePoint): PreviewResolvedBasePoint {
|
function resolveBasePoint(basePoint?: PreviewBasePoint): PreviewResolvedBasePoint {
|
||||||
|
|||||||
Reference in New Issue
Block a user