@@ -135,7 +135,7 @@ internal class FipPanel
135
135
private int [ ] _currentZoomLevel = new int [ 100 ] ;
136
136
137
137
138
- private int _currentLcdyOffset ;
138
+ private int _currentLcdYOffset ;
139
139
private int _currentLcdHeight ;
140
140
141
141
public IntPtr FipDevicePointer ;
@@ -167,6 +167,32 @@ internal class FipPanel
167
167
168
168
private double ScrollBarHeight => _htmlWindowHeight - 7.0 ;
169
169
170
+ private int GalaxyImageDisplayWidth => _htmlWindowWidth - 10 ;
171
+
172
+ private int GalaxyImageDisplayHeight
173
+ {
174
+ get
175
+ {
176
+ double aspectRatio ;
177
+
178
+ if ( _htmlWindowWidth >= _htmlWindowHeight )
179
+ {
180
+ aspectRatio = History . GalaxyImageLHeight / History . GalaxyImageLWidth ;
181
+ }
182
+ else
183
+ {
184
+ aspectRatio = History . GalaxyImagePHeight / History . GalaxyImagePWidth ;
185
+ }
186
+
187
+ return ( int ) ( GalaxyImageDisplayWidth * aspectRatio ) ;
188
+
189
+ }
190
+ }
191
+
192
+ private string GalaxyImageFileName => _htmlWindowWidth >= _htmlWindowHeight ? "galaxyl.png" : "galaxyp.png" ;
193
+
194
+ private int GalaxyImageMarginTop => ( int ) ( ( _htmlWindowHeight - GalaxyImageDisplayHeight ) / 2.0 ) ;
195
+
170
196
private DirectOutputClass . PageCallback _pageCallbackDelegate ;
171
197
private DirectOutputClass . SoftButtonCallback _softButtonCallbackDelegate ;
172
198
@@ -307,7 +333,7 @@ private bool SetTab(LcdTab tab)
307
333
308
334
_currentTabCursor = LcdTab . None ;
309
335
310
- _currentLcdyOffset = 0 ;
336
+ _currentLcdYOffset = 0 ;
311
337
312
338
File . WriteAllText ( _settingsPath , ( ( int ) _currentTab ) . ToString ( ) ) ;
313
339
}
@@ -618,7 +644,7 @@ private void SoftButtonCallback(IntPtr device, IntPtr buttons, IntPtr context)
618
644
619
645
_currentCard [ ( int ) _currentTab ] ++ ;
620
646
_currentZoomLevel [ ( int ) _currentTab ] ++ ;
621
- _currentLcdyOffset = 0 ;
647
+ _currentLcdYOffset = 0 ;
622
648
623
649
mustRefresh = true ;
624
650
}
@@ -632,16 +658,16 @@ private void SoftButtonCallback(IntPtr device, IntPtr buttons, IntPtr context)
632
658
{
633
659
_currentCard [ ( int ) _currentTab ] -- ;
634
660
_currentZoomLevel [ ( int ) _currentTab ] -- ;
635
- _currentLcdyOffset = 0 ;
661
+ _currentLcdYOffset = 0 ;
636
662
637
663
mustRefresh = true ;
638
664
}
639
665
640
666
break ;
641
667
case 2 : // scroll clockwise
642
- if ( state )
668
+ if ( state && _currentTab != LcdTab . Map )
643
669
{
644
- _currentLcdyOffset += 50 ;
670
+ _currentLcdYOffset += 50 ;
645
671
646
672
mustRender = false ;
647
673
@@ -651,14 +677,14 @@ private void SoftButtonCallback(IntPtr device, IntPtr buttons, IntPtr context)
651
677
break ;
652
678
case 4 : // scroll anti-clockwise
653
679
654
- if ( _currentLcdyOffset == 0 ) return ;
680
+ if ( _currentLcdYOffset == 0 ) return ;
655
681
656
- if ( state )
682
+ if ( state && _currentTab != LcdTab . Map )
657
683
{
658
- _currentLcdyOffset -= 50 ;
659
- if ( _currentLcdyOffset < 0 )
684
+ _currentLcdYOffset -= 50 ;
685
+ if ( _currentLcdYOffset < 0 )
660
686
{
661
- _currentLcdyOffset = 0 ;
687
+ _currentLcdYOffset = 0 ;
662
688
}
663
689
664
690
mustRender = false ;
@@ -825,15 +851,15 @@ private void CheckLcdOffset()
825
851
{
826
852
if ( _currentLcdHeight <= _htmlWindowHeight )
827
853
{
828
- _currentLcdyOffset = 0 ;
854
+ _currentLcdYOffset = 0 ;
829
855
}
830
856
831
- if ( _currentLcdyOffset + _htmlWindowHeight > _currentLcdHeight )
857
+ if ( _currentLcdYOffset + _htmlWindowHeight > _currentLcdHeight )
832
858
{
833
- _currentLcdyOffset = _currentLcdHeight - _htmlWindowHeight + 4 ;
859
+ _currentLcdYOffset = _currentLcdHeight - _htmlWindowHeight + 4 ;
834
860
}
835
861
836
- if ( _currentLcdyOffset < 0 ) _currentLcdyOffset = 0 ;
862
+ if ( _currentLcdYOffset < 0 ) _currentLcdYOffset = 0 ;
837
863
}
838
864
839
865
private ReturnValues AddPage ( uint pageNumber , bool setActive )
@@ -909,9 +935,16 @@ private void OnImageLoad(object sender, HtmlImageLoadEventArgs e)
909
935
910
936
using ( var graphics = Graphics . FromImage ( image ) )
911
937
{
912
- if ( e . Src . ToLower ( ) == "galaxy.png" && _currentTab == LcdTab . Map )
938
+ if ( e . Src . ToLower ( ) . StartsWith ( "galaxy" ) && _currentTab == LcdTab . Map )
913
939
{
914
- graphics . DrawPolygon ( _whitePen , History . TravelHistoryPoints . ToArray ( ) ) ;
940
+ if ( e . Src . ToLower ( ) . StartsWith ( "galaxyl" ) )
941
+ {
942
+ graphics . DrawPolygon ( _whitePen , History . TravelHistoryPointsL . ToArray ( ) ) ;
943
+ }
944
+ else
945
+ {
946
+ graphics . DrawPolygon ( _whitePen , History . TravelHistoryPointsP . ToArray ( ) ) ;
947
+ }
915
948
916
949
var zoomLevel = _currentZoomLevel [ ( int ) _currentTab ] / 2.0 + 1 ;
917
950
@@ -929,8 +962,19 @@ private void OnImageLoad(object sender, HtmlImageLoadEventArgs e)
929
962
var spaceX = Data . LocationData . StarPos [ 0 ] ;
930
963
var spaceZ = Data . LocationData . StarPos [ 2 ] ;
931
964
932
- var imgX = ( spaceX - History . SpaceMinX ) / ( History . SpaceMaxX - History . SpaceMinX ) * image . Width ;
933
- var imgY = ( History . SpaceMaxZ - spaceZ ) / ( History . SpaceMaxZ - History . SpaceMinZ ) * image . Height ;
965
+ var imgX = 0.0 ;
966
+ var imgY = 0.0 ;
967
+
968
+ if ( e . Src . ToLower ( ) . StartsWith ( "galaxyl" ) )
969
+ {
970
+ imgX = ( spaceX - History . SpaceMinXL ) / ( History . SpaceMaxXL - History . SpaceMinXL ) * image . Width ;
971
+ imgY = ( History . SpaceMaxZL - spaceZ ) / ( History . SpaceMaxZL - History . SpaceMinZL ) * image . Height ;
972
+ }
973
+ else
974
+ {
975
+ imgX = ( spaceX - History . SpaceMinXP ) / ( History . SpaceMaxXP - History . SpaceMinXP ) * image . Width ;
976
+ imgY = ( History . SpaceMaxZP - spaceZ ) / ( History . SpaceMaxZP - History . SpaceMinZP ) * image . Height ;
977
+ }
934
978
935
979
imgX -= markerWidth / 2.0 ;
936
980
imgY -= markerHeight / 2.0 ;
@@ -1388,6 +1432,10 @@ public void RefreshDevicePage(bool mustRender = true)
1388
1432
{
1389
1433
CurrentTab = _currentTab ,
1390
1434
CurrentPage = _currentPage ,
1435
+ GalaxyImageDisplayHeight = GalaxyImageDisplayHeight ,
1436
+ GalaxyImageDisplayWidth = GalaxyImageDisplayWidth ,
1437
+ GalaxyImageMarginTop = GalaxyImageMarginTop + "px" ,
1438
+ GalaxyImageFileName = GalaxyImageFileName ,
1391
1439
1392
1440
_currentZoomLevel = _currentZoomLevel [ ( int ) _currentTab ]
1393
1441
@@ -1562,16 +1610,16 @@ public void RefreshDevicePage(bool mustRender = true)
1562
1610
{
1563
1611
graphics . DrawImage ( _htmlImage , new Rectangle ( new Point ( HtmlWindowXOffset , 0 ) ,
1564
1612
new Size ( HtmlWindowUsableWidth , _htmlWindowHeight + 20 ) ) ,
1565
- new Rectangle ( new Point ( 0 , _currentLcdyOffset ) ,
1613
+ new Rectangle ( new Point ( 0 , _currentLcdYOffset ) ,
1566
1614
new Size ( HtmlWindowUsableWidth , _htmlWindowHeight + 20 ) ) ,
1567
1615
GraphicsUnit . Pixel ) ;
1568
1616
}
1569
1617
}
1570
1618
1571
- if ( _currentLcdHeight > _htmlWindowHeight )
1619
+ if ( _currentLcdHeight > _htmlWindowHeight && _currentTab != LcdTab . Map )
1572
1620
{
1573
1621
var scrollThumbHeight = _htmlWindowHeight / ( double ) _currentLcdHeight * ScrollBarHeight ;
1574
- var scrollThumbYOffset = _currentLcdyOffset / ( double ) _currentLcdHeight * ScrollBarHeight ;
1622
+ var scrollThumbYOffset = _currentLcdYOffset / ( double ) _currentLcdHeight * ScrollBarHeight ;
1575
1623
1576
1624
graphics . DrawRectangle ( _scrollPen , new Rectangle ( new Point ( _htmlWindowWidth - 9 , 2 ) ,
1577
1625
new Size ( 5 , ( int ) ScrollBarHeight ) ) ) ;
0 commit comments