@@ -352,7 +352,7 @@ const Elements = {
ready() {
const panel = this;
panel.$.canvas.addEventListener('mousedown', async (event) => {
- await callModelPreviewFunction('onMouseDown', { x: event.x, y: event.y });
+ await callModelPreviewFunction('onMouseDown', { x: event.x, y: event.y, button: event.button });
async function mousemove(event) {
await callModelPreviewFunction('onMouseMove', {
@@ -381,6 +381,14 @@ const Elements = {
panel.isPreviewDataDirty = true;
});
+ panel.$.canvas.addEventListener('wheel', async (event) => {
+ await callModelPreviewFunction('onMouseWheel', {
+ wheelDeltaY: event.wheelDeltaY,
+ wheelDeltaX: event.wheelDeltaX,
+ });
+ panel.isPreviewDataDirty = true;
+ });
+
const GlPreview = Editor._Module.require('PreviewExtends').default;
panel.glPreview = new GlPreview('scene:model-preview', 'query-model-preview-data');
panel.isPreviewDataDirty = true;
@@ -441,8 +449,8 @@ const Elements = {
exports.methods = {
/**
- *
- * @param {boolean} hasModel
+ *
+ * @param {boolean} hasModel
*/
updatePanelHidden(hasModel) {
this.$.noModel.hidden = hasModel;
diff --git a/editor/inspector/assets/material-header.js b/editor/inspector/assets/material-header.js
index 504f650ac9..f0ab30cb00 100644
--- a/editor/inspector/assets/material-header.js
+++ b/editor/inspector/assets/material-header.js
@@ -95,6 +95,7 @@ exports.methods = {
exports.ready = async function() {
const panel = this;
+ callMaterialPreviewFunction('resetCamera');
callMaterialPreviewFunction('setLightEnable', true);
panel.$.light.addEventListener('confirm', async () => {
await callMaterialPreviewFunction('setLightEnable', this.$.light.checked);
@@ -108,7 +109,7 @@ exports.ready = async function() {
});
panel.$.canvas.addEventListener('mousedown', async (event) => {
- await callMaterialPreviewFunction('onMouseDown', { x: event.x, y: event.y });
+ await callMaterialPreviewFunction('onMouseDown', { x: event.x, y: event.y, button: event.button });
async function mousemove(event) {
await callMaterialPreviewFunction('onMouseMove', {
@@ -136,6 +137,14 @@ exports.ready = async function() {
panel.isPreviewDataDirty = true;
});
+ panel.$.canvas.addEventListener('wheel', async (event) => {
+ await callMaterialPreviewFunction('onMouseWheel', {
+ wheelDeltaY: event.wheelDeltaY,
+ wheelDeltaX: event.wheelDeltaX
+ });
+ panel.isPreviewDataDirty = true;
+ });
+
const GlPreview = Editor._Module.require('PreviewExtends').default;
panel.glPreview = new GlPreview('scene:material-preview', 'query-material-preview-data');
@@ -153,6 +162,7 @@ exports.ready = async function() {
exports.update = async function(assetList, metaList) {
const panel = this;
+ callMaterialPreviewFunction('resetCamera');
panel.assetList = assetList;
panel.metaList = metaList;
diff --git a/editor/inspector/assets/mesh-preview.js b/editor/inspector/assets/mesh-preview.js
index 3630576330..a69fd88196 100644
--- a/editor/inspector/assets/mesh-preview.js
+++ b/editor/inspector/assets/mesh-preview.js
@@ -102,7 +102,7 @@ const Elements = {
panel.$.canvas.addEventListener('mousedown', async (event) => {
// Non-model previews do not respond to events
if (panel.$.previewType.value !== previewSelectType.shaded) { return; }
- await callMeshPreviewFunction('onMouseDown', { x: event.x, y: event.y });
+ await callMeshPreviewFunction('onMouseDown', { x: event.x, y: event.y, button: event.button });
async function mousemove(event) {
await callMeshPreviewFunction('onMouseMove', {
@@ -131,6 +131,16 @@ const Elements = {
panel.isPreviewDataDirty = true;
});
+ panel.$.canvas.addEventListener('wheel', async (event) => {
+ // Non-model previews do not respond to events
+ if (panel.$.previewType.value !== previewSelectType.shaded) { return; }
+ await callMeshPreviewFunction('onMouseWheel', {
+ wheelDeltaY: event.wheelDeltaY,
+ wheelDeltaX: event.wheelDeltaX,
+ });
+ panel.isPreviewDataDirty = true;
+ });
+
const GlPreview = Editor._Module.require('PreviewExtends').default;
panel.glPreview = new GlPreview('scene:mesh-preview', 'query-mesh-preview-data');
diff --git a/editor/inspector/assets/skeleton-preview.js b/editor/inspector/assets/skeleton-preview.js
index a30033d94d..f588382f70 100644
--- a/editor/inspector/assets/skeleton-preview.js
+++ b/editor/inspector/assets/skeleton-preview.js
@@ -49,7 +49,7 @@ const Elements = {
const panel = this;
panel.$.canvas.addEventListener('mousedown', async (event) => {
- await callSkeletonPreviewFunction('onMouseDown', { x: event.x, y: event.y });
+ await callSkeletonPreviewFunction('onMouseDown', { x: event.x, y: event.y, button: event.button });
async function mousemove(event) {
await callSkeletonPreviewFunction('onMouseMove', {
@@ -79,6 +79,15 @@ const Elements = {
panel.isPreviewDataDirty = true;
});
+ panel.$.canvas.addEventListener('wheel', async (event) => {
+ await callSkeletonPreviewFunction('onMouseWheel', {
+ wheelDeltaY: event.wheelDeltaY,
+ wheelDeltaX: event.wheelDeltaX,
+ });
+ panel.isPreviewDataDirty = true;
+ });
+
+
const GlPreview = Editor._Module.require('PreviewExtends').default;
panel.glPreview = new GlPreview('scene:skeleton-preview', 'query-skeleton-preview-data');