INNER CODE UNIT · JavaScript

checkScale

ayushk7/CodeWire · javascript/AppStage/intiStage.js:23

            var checkScale = e.evt.deltaY > 0 ? oldScale / AppStage.zoomScale : oldScale * AppStage.zoomScale;
            if (checkScale > 0.175 && checkScale < 1.6) {
                newScale = checkScale;
            }
            // console.log(stage.x() + pointer.x + " " + stage.y() + pointer.y)
            stage.scale({ x: newScale, y: newScale });

            var newPos = {
                x: pointer.x - mousePointTo.x * newScale,
                y: pointer.y - mousePointTo.y * newScale,
            };
            stage.container().style.backgroundSize = `${stage.scaleX() * 10}rem ${stage.scaleY() * 10}rem`;
            stage.position(newPos);
            stage.batchDraw();
            stage.container().style.backgroundPosition = `${stage.position().x}px ${stage.position().y}px`;
            // console.log(stage.scaleX());
        });
        stage.container().tabIndex = 1;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…