提交 221f2b0a 编写于 作者: M Matt Bierner

Tune image zooming to be less finicky

Fixes #42486
上级 611b4b36
...@@ -335,7 +335,7 @@ interface ImageState { ...@@ -335,7 +335,7 @@ interface ImageState {
} }
class InlineImageView { class InlineImageView {
private static readonly SCALE_PINCH_FACTOR = 0.01; private static readonly SCALE_PINCH_FACTOR = 0.075;
private static readonly MAX_SCALE = 20; private static readonly MAX_SCALE = 20;
private static readonly MIN_SCALE = 0.1; private static readonly MIN_SCALE = 0.1;
...@@ -519,8 +519,8 @@ class InlineImageView { ...@@ -519,8 +519,8 @@ class InlineImageView {
} }
// scrolling up, pinching out should increase the scale // scrolling up, pinching out should increase the scale
const delta = -e.deltaY; const delta = e.deltaY < 0 ? 1 : -1;
updateScale(scale as number + delta * InlineImageView.SCALE_PINCH_FACTOR); updateScale(scale as number * (1 - delta * InlineImageView.SCALE_PINCH_FACTOR));
}) })
.on(DOM.EventType.SCROLL, () => { .on(DOM.EventType.SCROLL, () => {
if (!imgElement || !imgElement.parentElement || scale === 'fit') { if (!imgElement || !imgElement.parentElement || scale === 'fit') {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册