MCPcopy
hub / github.com/ollm/OpenComic / dragZoom

Function dragZoom

scripts/reading.js:2627–2666  ·  view source on GitHub ↗
(x, y, animation = false)

Source from the content-addressed store, hash-verified

2625
2626// Drag zoom
2627function dragZoom(x, y, animation = false)
2628{
2629 const transition = app.scrollTransition('dragZoom', animation ? _config.readingViewSpeed : 0);
2630 const withLimits = notCrossZoomLimits(scalePrevData.tranX2 + x, scalePrevData.tranY2 + y);
2631
2632 const diff = {
2633 x: (scalePrevData.tranX2 + x) - withLimits.x,
2634 y: (scalePrevData.tranY2 + y) - withLimits.y,
2635 };
2636
2637 x = withLimits.x;
2638 y = withLimits.y;
2639
2640 const contentRight = template._contentRight();
2641
2642 if(config.readingGlobalZoom && readingViewIs('scroll'))
2643 {
2644 scalePrevData.tranX = zoomMoveData.tranX = x;
2645 zoomMoveData.tranY = scalePrevData.tranY;
2646
2647 dom.this(contentRight).find('.reading-body > div').css({
2648 transition: 'transform '+transition.speed+'s '+transition.function+', z-index 0s',
2649 transform: 'translateX('+app.roundDPR(x)+'px) translateY('+app.roundDPR(scalePrevData.tranY)+'px) scale('+scalePrevData.scale+')',
2650 transformOrigin: 'top center',
2651 });
2652 }
2653 else
2654 {
2655 zoomMoveData.tranX = x;
2656 zoomMoveData.tranY = y;
2657
2658 dom.this(contentRight).find('.image-position'+currentZoomIndex, true).css({
2659 transition: 'transform '+transition.speed+'s '+transition.function+', z-index 0s',
2660 transform: 'translateX('+app.roundDPR(x)+'px) translateY('+app.roundDPR(y)+'px) scale('+scalePrevData.scale+')',
2661 transformOrigin: 'center center',
2662 });
2663 }
2664
2665 return diff;
2666}
2667
2668function dragZoomEnd(force = false)
2669{

Callers 4

zoomMoveFunction · 0.85
applyMoveZoomWithMouseFunction · 0.85
pointermoveFunction · 0.85
readFunction · 0.85

Calls 2

notCrossZoomLimitsFunction · 0.85
readingViewIsFunction · 0.85

Tested by

no test coverage detected