@@ -425,28 +425,6 @@ class VRuler {
425425 // in case of disabled ruler at docload or event like 'moveend' calculation of offset can be ignored
426426 if ( ! this . _map . options . docBounds || ! this . options . showruler ) return ;
427427
428- const scale : number = this . _map . getZoomScale ( this . _map . getZoom ( ) , 10 ) ;
429- const mapPane = this . _map . _mapPane ;
430- const topLeft = this . _map . latLngToLayerPoint (
431- this . _map . options . docBounds . getNorthWest ( ) ,
432- ) ;
433- const firstTileXTranslate = topLeft . y ;
434-
435- let mapPaneYTranslate : number = 0 ;
436-
437- // Extract the transform property directly from the mapPane style
438- const transformValue = mapPane . style . transform ;
439-
440- // Check if the transformValue exists and contains 'translate3d'
441- if ( transformValue && transformValue . startsWith ( 'translate3d' ) ) {
442- // Split the transformValue string by commas and get the Y value
443- const transformArray = transformValue . split ( ',' ) ;
444- if ( transformArray . length >= 2 ) {
445- // The Y value is the second item in the 'translate3d' format
446- mapPaneYTranslate = parseFloat ( transformArray [ 1 ] . trim ( ) ) ;
447- }
448- }
449-
450428 // we need to also consider if there is more then 1 page then pageoffset is crucial to consider
451429 // i have calculated current page using pageoffset and pageWidth coming from CORE
452430 // based on that calculate the page offset
@@ -462,10 +440,9 @@ class VRuler {
462440 ( this . _map . _docLayer . _docPixelSize . y / this . _map . _docLayer . _pages ) ;
463441
464442 const rulerOffset : number =
465- mapPaneYTranslate +
466- firstTileXTranslate +
467- pageoffset +
468- this . options . tileMargin * scale ;
443+ - app . file . viewedRectangle . cY1 +
444+ this . options . tileMargin * app . getScale ( ) +
445+ pageoffset ;
469446
470447 this . _rFace . style . marginInlineStart = rulerOffset + 'px' ;
471448
0 commit comments