@@ -41,7 +41,7 @@ internal static void DrawGlobalHeaders(
4141 HierarchyGridViewModel viewModel ,
4242 SkiaTheme theme ,
4343 IList < ( ElementCoordinates , Guid ) > previousGlobalCoordinates ,
44- double screenScale = 1d
44+ double screenScale
4545 )
4646 {
4747 // Don't draw if structure doesn't allow it
@@ -164,17 +164,19 @@ private static void DrawGlobalHeader(
164164 GlobalHeader globalHeader = GlobalHeader . Local
165165 )
166166 {
167+ var actualScale = screenScale * viewModel . Scale ;
167168 var rect = SKRect . Create (
168- ( float ) ( left * screenScale ) ,
169- ( float ) ( top * screenScale ) ,
170- ( float ) ( width * screenScale ) ,
171- ( float ) ( height * screenScale )
169+ ( float ) ( left * actualScale ) ,
170+ ( float ) ( top * actualScale ) ,
171+ ( float ) ( width * actualScale ) ,
172+ ( float ) ( height * actualScale )
172173 ) ;
173174 var coordinates = new ElementCoordinates (
174- left * screenScale ,
175- top * screenScale ,
176- ( left + width ) * screenScale ,
177- ( top + height ) * screenScale
175+ left ,
176+ top ,
177+ ( left + width ) ,
178+ ( top + height ) ,
179+ actualScale
178180 ) ;
179181
180182 var isHovered = previousGlobalCoordinates
@@ -195,8 +197,8 @@ private static void DrawGlobalHeader(
195197
196198 var decorator = GetGlobalHeaderDecorator (
197199 ! expanded ,
198- left * screenScale ,
199- top * screenScale ,
200+ left * actualScale ,
201+ top * actualScale ,
200202 globalHeader
201203 ) ;
202204 paint . Color = isHovered
@@ -221,9 +223,11 @@ internal static void DrawColumnHeaders(
221223 Func < HierarchyGridViewModel , HierarchyDefinition [ ] > selector ,
222224 float availableWidth ,
223225 ref int headerCount ,
224- double screenScale = 1d
226+ double screenScale
225227 )
226228 {
229+ var actualAvailableWidth = availableWidth / viewModel . Scale ;
230+
227231 viewModel . ColumnsParents . Clear ( ) ;
228232 var hdefs = selector ( viewModel ) . ToArr ( ) ;
229233
@@ -252,7 +256,7 @@ internal static void DrawColumnHeaders(
252256 column ++ ;
253257 }
254258
255- while ( column < hdefs . Length && currentPosition < availableWidth )
259+ while ( column < hdefs . Length && currentPosition < actualAvailableWidth )
256260 {
257261 var hdef = hdefs [ column ] ;
258262 var width = viewModel . ColumnsWidths [ column ] ;
@@ -402,6 +406,8 @@ internal static void DrawRowHeaders(
402406 double screenScale = 1d
403407 )
404408 {
409+ var actualAvailableHeight = availableHeight / viewModel . Scale ;
410+
405411 viewModel . RowsParents . Clear ( ) ;
406412 var hdefs = selector ( viewModel ) . ToArr ( ) ;
407413
@@ -430,7 +436,7 @@ internal static void DrawRowHeaders(
430436 row ++ ;
431437 }
432438
433- while ( row < hdefs . Length && currentPosition < availableHeight )
439+ while ( row < hdefs . Length && currentPosition < actualAvailableHeight )
434440 {
435441 var hdef = hdefs [ row ] ;
436442 var height = viewModel . RowsHeights [ row ] ;
@@ -572,11 +578,12 @@ private static void DrawHeader(
572578 double screenScale
573579 )
574580 {
581+ var actualScale = screenScale * viewModel . Scale ;
575582 var rect = SKRect . Create (
576- ( float ) ( left * screenScale ) ,
577- ( float ) ( top * screenScale ) ,
578- ( float ) ( width * screenScale ) ,
579- ( float ) ( height * screenScale )
583+ ( float ) ( left * actualScale ) ,
584+ ( float ) ( top * actualScale ) ,
585+ ( float ) ( width * actualScale ) ,
586+ ( float ) ( height * actualScale )
580587 ) ;
581588
582589 var renderInfo = RenderInfo . FindRender ( viewModel , theme , hdef ) ;
@@ -590,7 +597,7 @@ double screenScale
590597 paint . Color = theme . BorderColor ;
591598 canvas . DrawRect ( rect , paint ) ;
592599
593- GetHeaderDecorator ( hdef , left * screenScale , top * screenScale )
600+ GetHeaderDecorator ( hdef , left * actualScale , top * actualScale )
594601 . IfSome ( decorator =>
595602 {
596603 using var localPaint = new SKPaint ( ) ;
@@ -606,13 +613,19 @@ double screenScale
606613 top ,
607614 width ,
608615 height ,
609- screenScale ,
616+ actualScale ,
610617 renderInfo ,
611618 viewModel . HeaderFontFamily ,
612619 viewModel . HeaderFontSize
613620 ) ;
614621
615- var coordinates = new ElementCoordinates ( left , top , left + width , top + height ) ;
622+ var coordinates = new ElementCoordinates (
623+ left ,
624+ top ,
625+ left + width ,
626+ top + height ,
627+ actualScale
628+ ) ;
616629 viewModel . HeadersCoordinates . Add ( new ( coordinates , new ( coordinates , hdef ) ) ) ;
617630
618631 headerCount ++ ;
@@ -776,12 +789,11 @@ internal static void DrawCells(
776789 this SKCanvas canvas ,
777790 HierarchyGridViewModel viewModel ,
778791 SkiaTheme theme ,
779- IEnumerable < PositionedCell > cells ,
780- double screenScale = 1d
792+ IEnumerable < PositionedCell > cells
781793 )
782794 {
783795 foreach ( var cell in cells )
784- canvas . DrawCell ( viewModel , theme , cell , screenScale ) ;
796+ canvas . DrawCell ( viewModel , theme , cell ) ;
785797 }
786798
787799 private static void DrawCell (
@@ -792,11 +804,13 @@ private static void DrawCell(
792804 double screenScale = 1d
793805 )
794806 {
807+ var actualScale = screenScale * viewModel . Scale ;
808+
795809 var rect = SKRect . Create (
796- ( float ) ( cell . Left * screenScale ) ,
797- ( float ) ( cell . Top * screenScale ) ,
798- ( float ) ( cell . Width * screenScale ) ,
799- ( float ) ( cell . Height * screenScale )
810+ ( float ) ( cell . Left * actualScale ) ,
811+ ( float ) ( cell . Top * actualScale ) ,
812+ ( float ) ( cell . Width * actualScale ) ,
813+ ( float ) ( cell . Height * actualScale )
800814 ) ;
801815
802816 var renderInfo = RenderInfo . FindRender ( viewModel , theme , cell ) ;
@@ -840,10 +854,10 @@ private static void DrawCell(
840854 localPaint . Color = fci . BackgroundColor . ToSKColor ( ) ;
841855
842856 rect = SKRect . Create (
843- ( float ) ( cell . Left * screenScale ) + borderThickness ,
844- ( float ) ( cell . Top * screenScale ) + borderThickness ,
845- ( float ) ( cell . Width * screenScale ) - ( borderThickness + 1f ) ,
846- ( float ) ( cell . Height * screenScale ) - ( borderThickness + 1f )
857+ ( float ) ( cell . Left * actualScale ) + borderThickness ,
858+ ( float ) ( cell . Top * actualScale ) + borderThickness ,
859+ ( float ) ( cell . Width * actualScale ) - ( borderThickness + 1f ) ,
860+ ( float ) ( cell . Height * actualScale ) - ( borderThickness + 1f )
847861 ) ;
848862 canvas . DrawRect ( rect , localPaint ) ;
849863
@@ -854,13 +868,13 @@ private static void DrawCell(
854868 canvas . DrawRect ( rect , localPaint ) ;
855869 } ) ;
856870
857- DrawSelectionBorder ( canvas , viewModel , theme , cell , screenScale , paint , ref rect ) ;
871+ DrawSelectionBorder ( canvas , viewModel , theme , cell , actualScale , paint , ref rect ) ;
858872
859- RenderCellText ( canvas , viewModel , theme , cell , screenScale , renderInfo ) ;
860- RenderLeftSideDecor ( canvas , cell , renderInfo , screenScale ) ;
861- RenderRightSideDecor ( canvas , cell , renderInfo , screenScale ) ;
873+ RenderCellText ( canvas , viewModel , theme , cell , actualScale , renderInfo ) ;
874+ RenderLeftSideDecor ( canvas , cell , renderInfo , actualScale ) ;
875+ RenderRightSideDecor ( canvas , cell , renderInfo , actualScale ) ;
862876
863- viewModel . CellsCoordinates . Add ( ( new ( cell ) , cell ) ) ;
877+ viewModel . CellsCoordinates . Add ( ( new ( cell , viewModel . Scale ) , cell ) ) ;
864878 }
865879
866880 private static void RenderRightSideDecor (
0 commit comments