From a94f4bac432ac7e802f51218171bd7b8daf5cca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AA=9B=E5=AA=9B?= Date: Fri, 15 Sep 2023 10:15:08 +0800 Subject: [PATCH] use asset image in asset header (#16137) --- 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 255b025959c..7d897239623 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', @@ -225,7 +222,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); @@ -256,19 +253,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;