Пример #1
0
        private void worldMapDisplay_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            WorldMapDisplay s = (WorldMapDisplay)sender;

            int row = 0, column = 0;

            if (s != null)
            {
                row    = Grid.GetRow(s);
                column = Grid.GetColumn(s);
            }

            if (!isWorldMapZoomed)
            {
                GridApplication.ColumnDefinitions[column].Width = new GridLength(GridApplication.ColumnDefinitions[column].Width.Value * worldMapZoomFactor, GridUnitType.Star);
                GridApplication.RowDefinitions[row].Height      = new GridLength(GridApplication.RowDefinitions[row].Height.Value * worldMapZoomFactor, GridUnitType.Star);
                isWorldMapZoomed = true;
            }
            else
            {
                GridApplication.ColumnDefinitions[column].Width = new GridLength(GridApplication.ColumnDefinitions[column].Width.Value / worldMapZoomFactor, GridUnitType.Star);
                GridApplication.RowDefinitions[row].Height      = new GridLength(GridApplication.RowDefinitions[row].Height.Value / worldMapZoomFactor, GridUnitType.Star);
                isWorldMapZoomed = false;
            }
        }
Пример #2
0
        private void WorldMapDisplay_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            WorldMapDisplay s = (WorldMapDisplay)sender;

            int row=0, column=0;

            if (s != null)
            {
                row = Grid.GetRow(s);
                column = Grid.GetColumn(s);
            }


            if (!isZoomed)
            {
                BaseGrid.ColumnDefinitions[column].Width = new GridLength(BaseGrid.ColumnDefinitions[column].Width.Value * zoomFactor, GridUnitType.Star);
                BaseGrid.RowDefinitions[row].Height = new GridLength(BaseGrid.RowDefinitions[row].Height.Value * zoomFactor, GridUnitType.Star);
                localWorldMapDisplay2.IsExtended = true;
                lastZoomedCol = column;
                lastZoomedRow = row;
                isZoomed = true;
            }
            else
            {
                BaseGrid.ColumnDefinitions[lastZoomedCol].Width = new GridLength(BaseGrid.ColumnDefinitions[lastZoomedCol].Width.Value / zoomFactor, GridUnitType.Star);
                BaseGrid.RowDefinitions[lastZoomedRow].Height = new GridLength(BaseGrid.RowDefinitions[lastZoomedRow].Height.Value / zoomFactor, GridUnitType.Star);
                localWorldMapDisplay2.IsExtended = false;
                isZoomed = false;
                if(lastZoomedRow!=row || lastZoomedCol!=column)
                {
                    BaseGrid.ColumnDefinitions[column].Width = new GridLength(BaseGrid.ColumnDefinitions[column].Width.Value * zoomFactor, GridUnitType.Star);
                    BaseGrid.RowDefinitions[row].Height = new GridLength(BaseGrid.RowDefinitions[row].Height.Value * zoomFactor, GridUnitType.Star);
                    localWorldMapDisplay2.IsExtended = true;
                    lastZoomedCol = column;
                    lastZoomedRow = row;
                    isZoomed = true;
                }
            }
        }