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

Function pointermove

scripts/reading.js:4673–4912  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

4671var contentLeftRect = false, contentRightRect = false, barHeaderRect = false, touchevents = {active: false, start: false, distance: 0, scale: 0, maxTouches: 0, numTouches: 0, touches: [], touchesXY: [], type: 'move'}, pointermoveEvent = false;
4672
4673function pointermove(event)
4674{
4675 pointermoveEvent = event;
4676
4677 let pageX = app.pageX(event);
4678 let pageY = app.pageY(event);
4679
4680 currentMousePosition = {
4681 pageX: pageX,
4682 pageY: pageY,
4683 };
4684
4685 if(haveZoom) // Drag Image zoom
4686 {
4687 if(contentRightRect === false)
4688 {
4689 contentRightRect = template._contentRight().getBoundingClientRect();
4690 let _contentRightRect = template._contentRight().firstElementChild.firstElementChild.getBoundingClientRect();
4691 contentRightRect.width = _contentRightRect.width;
4692 }
4693
4694 if(config.readingMoveZoomWithMouse && (!readingViewIs('scroll') || config.readingScrollWithMouse) && event instanceof PointerEvent)
4695 {
4696 if(pageX > contentRightRect.left && pageY > contentRightRect.top)
4697 {
4698 event.preventDefault();
4699 applyMoveZoomWithMouse(pageX, pageY);
4700 }
4701 }
4702 else if(zoomMoveData.active && !(event instanceof TouchEvent))
4703 {
4704 event.preventDefault();
4705
4706 let x = pageX - zoomMoveData.x;
4707 let y = pageY - zoomMoveData.y;
4708
4709 dragZoom(x, y);
4710 }
4711 }
4712
4713 if(touchevents.active && event instanceof TouchEvent)
4714 {
4715 let touches = event.touches;
4716
4717 // Simulate touch with 2 fingers
4718 //if(event.ctrlKey)
4719 // touches = [event.touches[0], touchevents.touches[1] || touchevents.touches[0]];
4720
4721 let numTouches = touches.length;
4722
4723 if(numTouches > touchevents.maxTouches)
4724 touchevents.maxTouches = numTouches;
4725
4726 if(!touchevents.start)
4727 {
4728 let touchesXY = app.touchesXY(event);
4729 let maxDiff = Math.max(...app.touchesDiff(touchevents.touchesXY, touchesXY));
4730

Callers

nothing calls this directly

Calls 5

readingViewIsFunction · 0.85
applyMoveZoomWithMouseFunction · 0.85
dragZoomFunction · 0.85
applyScaleFunction · 0.85
hideMouseInFullscreenFunction · 0.85

Tested by

no test coverage detected