Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×

Canvas scrolling bug (with likely cause in code)

I've managed to reproduce the bug where scrolling the canvas causes the map to jump around and become truncated. I'm reproducing this using a 30×22 map in Chrome. Depending on the laptop that I use to reproduce I have to set the zoom between 40% and 60%. To reproduce zoom just enough for the entire canvas to fit (vertically) within the view but not enough to also fit the top/bottom margins. The engine code contains the following code (variables named by me as the actual JS code was minified): const  __editorWrapper  =   $ ( "#editor-wrapper" ); __editorWrapper . on ( "scroll" ,  function () {      const  __scaledOffsetVertical  =   Math . round (__editorWrapper . scrollTop ()  /  d20 . engine . canvasZoom);      // ...      if  (__scaledOffsetVertical  <  d20 . engine . padding) {         d20 . engine . paddingOffset[ 1 ]  =  d20 . engine . padding  -  __scaledOffsetVertical;         d20 . engine . currentCanvasOffset[ 1 ]  =   0 ;     }  else  {          if  (d20 . engine . pageHeight  /  d20 . engine . canvasZoom  -  __scaledOffsetVertical  -  d20 . engine . canvasHeight  /  d20 . engine . canvasZoom  +  d20 . engine . padding  <=   0 ) {             d20 . engine . paddingOffset[ 1 ]  =  d20 . engine . pageHeight  /  d20 . engine . canvasZoom  -  __scaledOffsetVertical  -  d20 . engine . canvasHeight  /  d20 . engine . canvasZoom  +  d20 . engine . padding;             d20 . engine . currentCanvasOffset[ 1 ]  =  __scaledOffsetVertical  -  d20 . engine . padding  +  d20 . engine . paddingOffset[ 1 ]         }  else  {             d20 . engine . paddingOffset[ 1 ]  =   0 ;             d20 . engine . currentCanvasOffset[ 1 ]  =  __scaledOffsetVertical  -  d20 . engine . padding;         }     }      // ...      const  __pageHeight  =  d20 . engine . pageHeight;      const  __editorHeight  =   $ ( "#editor-wrapper" ) . height ()  -  d20 . engine . paddingOffset[ 1 ]  -  d20 . engine . scrollbarSize;      const  __height  =   Math . min (__pageHeight, __editorHeight);      // ...      const  __offsetTop  =  d20 . engine . paddingOffset[ 1 ]  +   "px" ;     __canvasContainer[ 0 ] . style . top  =  __offsetTop;     d20 . engine . redrawScreenNextTick ();      // ... }); Now the second conditional case (the one that checks whether the equation is <= 0) seems to be the culprit. Not sure what the intent was but with the current formula as you scroll past the top of the canvas, the canvas jumps partially off-screen. Canvas being off-screen causes the bottom of the map to be cut-off. I would debug this further but I don't have access to the original sources and working with the minified ones is a nightmare.
1586718816

Edited 1586719513
After a bit more investigative work, it seems that the canvas position is always (ie. at all zoom levels) wrong when scrolling near the bottom (or the right-most edge) of the map. The easiest way to observe this is to add a red border to the div with class="canvas-container".
1586859138

Edited 1586859454
(Bumping in hope of this elusive bug being reproduced by devs.) These look like manifestations of the same issue from the last couple of years: <a href="https://app.roll20.net/forum/post/2299656/bug-while-scrolling-on-a-big-map" rel="nofollow">https://app.roll20.net/forum/post/2299656/bug-while-scrolling-on-a-big-map</a> <a href="https://www.reddit.com/r/Roll20/comments/4w4bct/weird_scrolling/" rel="nofollow">https://www.reddit.com/r/Roll20/comments/4w4bct/weird_scrolling/</a> <a href="https://app.roll20.net/forum/post/311717/cant-see-the-whole-map" rel="nofollow">https://app.roll20.net/forum/post/311717/cant-see-the-whole-map</a> &nbsp;(the first post, the rest of the thread is about a different issue)
*bump*
1587317541
GiGs
Pro
Sheet Author
API Scripter
Thats a very nice find. Lets hope they take notice.
Hey&nbsp;Patrys -&nbsp; Ooo good find. I'll definitely get this sent off to the dev team. Thanks for the awesome feedback and assistance!