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

Function changeMagnifyingGlass

scripts/reading.js:2804–2838  ·  view source on GitHub ↗
(mode, value, save)

Source from the content-addressed store, hash-verified

2802
2803//Magnifying glass settings
2804function changeMagnifyingGlass(mode, value, save)
2805{
2806 let contentRight = template._contentRight();
2807 let rect = contentRight.getBoundingClientRect();
2808
2809 let pageX = (rect.width / 2) + rect.left;
2810 let pageY = (rect.height / 2) + rect.top;
2811
2812 if(mode == 1) //Set the zoom
2813 {
2814 magnifyingGlassControl(1, {pageX: pageX, pageY: pageY, originalEvent: {touches: false}}, {zoom: value});
2815
2816 if(save) storage.updateVar('config', 'readingMagnifyingGlassZoom', value);
2817
2818 render.setScaleMagnifyingGlass(value, doublePage.active());
2819 }
2820 else if(mode == 2) //Set the size
2821 {
2822 magnifyingGlassControl(1, {pageX: pageX, pageY: pageY, originalEvent: {touches: false}}, {size: value});
2823
2824 if(save) storage.updateVar('config', 'readingMagnifyingGlassSize', value);
2825 }
2826 else if(mode == 3) //Set the ratio
2827 {
2828 magnifyingGlassControl(1, {pageX: pageX, pageY: pageY, originalEvent: {touches: false}}, {ratio: value});
2829
2830 if(save) storage.updateVar('config', 'readingMagnifyingGlassRatio', value);
2831 }
2832 else if(mode == 4) //Set the radius
2833 {
2834 magnifyingGlassControl(1, {pageX: pageX, pageY: pageY, originalEvent: {touches: false}}, {radius: value});
2835
2836 if(save) storage.updateVar('config', 'readingMagnifyingGlassRadius', value);
2837 }
2838}
2839
2840var magnifyingGlassView = false, magnifyingGlassPosition = {x: false, y: false, mode: false};
2841

Callers

nothing calls this directly

Calls 1

magnifyingGlassControlFunction · 0.85

Tested by

no test coverage detected