From a6f079e402e7c6ee3f5cf80c20a6a2a9bc7f32b0 Mon Sep 17 00:00:00 2001 From: yanOO1497 Date: Wed, 30 Aug 2023 14:24:31 +0800 Subject: [PATCH] use asset image in asset header --- editor/inspector/contributions/asset.js | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/editor/inspector/contributions/asset.js b/editor/inspector/contributions/asset.js index 1482beec798..16deceb7213 100644 --- a/editor/inspector/contributions/asset.js +++ b/editor/inspector/contributions/asset.js @@ -4,7 +4,6 @@ const path = require('path'); const { injectionStyle } = require('../utils/prop'); const History = require('./asset-history/index'); -const showImage = ['image', 'texture', 'sprite-frame', 'gltf-mesh']; exports.listeners = {}; exports.style = fs.readFileSync(path.join(__dirname, './asset.css'), 'utf8'); @@ -12,8 +11,7 @@ exports.style = fs.readFileSync(path.join(__dirname, './asset.css'), 'utf8'); exports.template = `
- - + @@ -41,7 +39,6 @@ exports.$ = { header: '.header', content: '.content', copy: '.copy', - icon: '.icon', image: '.image', name: '.name', help: '.help', @@ -216,7 +213,7 @@ const Elements = { } }); - panel.$.icon.addEventListener('click', (event) => { + panel.$.image.addEventListener('click', (event) => { event.stopPropagation(); panel.uuidList.forEach((uuid) => { Editor.Message.request('assets', 'ui-kit:touch-asset', uuid); @@ -247,19 +244,9 @@ const Elements = { panel.$.copy.style.display = 'none'; } - const isImage = showImage.includes(panel.asset.importer); - if (isImage) { - panel.$.image.value = panel.asset.uuid; - panel.$.header.prepend(panel.$.image); - panel.$.icon.remove(); - } else { - panel.$.icon.value = panel.asset.importer === '*' ? 'file' : panel.asset.importer; - panel.$.header.prepend(panel.$.icon); - - panel.$.image.value = ''; // 清空,避免缓存 - panel.$.image.remove(); - } + panel.$.image.value = panel.asset.uuid; + panel.$.image.importer = panel.asset.importer; }, async isDirty() { const panel = this;