feat(Image): Image support mouse wheel zoom in and out (#5703), close #5700

pull/5724/head
WD 2022-06-18 11:14:59 +08:00 committed by GitHub
parent d9304506d3
commit 168626bfeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -295,6 +295,14 @@ const Preview = defineComponent({
},
{ flush: 'post', immediate: true },
);
watch([lastWheelZoomDirection], () => {
const { wheelDirection } = lastWheelZoomDirection.value;
if (wheelDirection > 0) {
onZoomOut();
} else if (wheelDirection < 0) {
onZoomIn();
}
});
});
onUnmounted(() => {
removeListeners();