public static GetCurrentWorkingArea ( Vector2i pos ) : IntRect | ||
pos | Vector2i | |
return | IntRect |
public void ToggleFitToMonitorHeight() { UnforceAlwaysOnTop(); IntRect bounds; if (FitToMonitorHeightAlternative) { bounds = ImageViewerUtils.GetCurrentWorkingArea(Window.Position); } else { bounds = ImageViewerUtils.GetCurrentBounds(Window.Position); } if (CurrentZoom == 1) { // Fit to Monitor Height FitToMonitorHeight = true; if (Image.Rotation == 90 || Image.Rotation == 270) { Zoom(1 + (((float)bounds.Height - Image.Texture.Size.X) / Image.Texture.Size.X), true); } else { Zoom(1 + (((float)bounds.Height - Image.Texture.Size.Y) / Image.Texture.Size.Y), true); } NextWindowPos = new Vector2i(NextWindowPos.X, 0); } else { // Full Size FitToMonitorHeight = false; Zoom(1, true); NextWindowPos = new Vector2i(NextWindowPos.X < 0 ? 0 : NextWindowPos.X, NextWindowPos.Y < 0 ? 0 : NextWindowPos.Y); } if (Image.Texture.Size.X * CurrentZoom >= VideoMode.DesktopMode.Width) { NextWindowPos = new Vector2i(0, 0); // Position Window at 0,0 if the image is large (ie: a Desktop wallpaper) } else if (!FitToMonitorHeightAlternative) { ForceAlwaysOnTopNextTick = true; } AutomaticallyZoomed = false; }
public void ResetImage() { Zoom(1f); AutomaticallyZoomed = false; FlippedX = false; RotateImage(DefaultRotation); // Force Fit To Monitor Height? Vector2i imagePos = new Vector2i((int)NextWindowPos.X + ((int)Image.Texture.Size.X / 2), (int)NextWindowPos.Y + ((int)Image.Texture.Size.Y / 2)); IntRect currentBounds = ImageViewerUtils.GetCurrentBounds(imagePos); if (Config.Setting_LimitImagesToMonitorHeight && Image.Texture.Size.Y > Image.Texture.Size.X && Image.Texture.Size.Y > currentBounds.Height) { // Fit to monitor height if it's higher than monitor height. Zoom(1 + (((float)currentBounds.Height - Image.Texture.Size.Y) / Image.Texture.Size.Y), true); FitToMonitorHeightForced = true; } // Center image or place in top-left corner if it's a large/wide image. IntRect currentWorkingArea; if (!FitToMonitorHeightForced) { currentWorkingArea = ImageViewerUtils.GetCurrentWorkingArea(imagePos); } else { currentWorkingArea = currentBounds; } if (Config.Setting_PositionLargeWideImagesInCorner && Image.Texture.Size.X * CurrentZoom > Image.Texture.Size.Y * CurrentZoom && Image.Texture.Size.X * CurrentZoom >= currentWorkingArea.Width) { NextWindowPos = new Vector2i(currentWorkingArea.Left, currentWorkingArea.Top); } else { NextWindowPos = new Vector2i(currentWorkingArea.Left + (currentWorkingArea.Width / 2) - ((int)(Image.Texture.Size.X * CurrentZoom) / 2), currentWorkingArea.Top + (currentWorkingArea.Height / 2) - ((int)(Image.Texture.Size.Y * CurrentZoom) / 2)); } // Force Always on Top? if (FitToMonitorHeightForced || (Image.Texture.Size.Y >= currentBounds.Height && Image.Texture.Size.X < currentBounds.Width)) { ForceAlwaysOnTopNextTick = true; } }
public void ResetImage() { Zoom(1f); AutomaticallyZoomed = false; FlippedX = false; RotateImage(DefaultRotation); // Force Fit To Monitor Height? Vector2i imagePos = new Vector2i((int)NextWindowPos.X + ((int)Image.Texture.Size.X / 2), (int)NextWindowPos.Y + ((int)Image.Texture.Size.Y / 2)); IntRect currentBounds = ImageViewerUtils.GetCurrentBounds(imagePos); if (Config.Setting_LimitImagesToMonitor != Config.NONE) { // Fit to monitor height/width int limit = Config.Setting_LimitImagesToMonitor; if (limit == Config.AUTO) { if (currentBounds.Height < currentBounds.Width) { limit = Config.HEIGHT; } else { limit = Config.WIDTH; } } if (limit == Config.HEIGHT && Image.Texture.Size.Y > currentBounds.Height) { Zoom(1 + (((float)currentBounds.Height - Image.Texture.Size.Y) / Image.Texture.Size.Y), true); FitToMonitorHeightForced = true; } else if (limit == Config.WIDTH && Image.Texture.Size.X > currentBounds.Width) { Zoom(1 + (((float)currentBounds.Width - Image.Texture.Size.X) / Image.Texture.Size.X), true); AutomaticallyZoomed = true; } } if (Math.Min(Image.Texture.Size.X, Image.Texture.Size.Y) < Config.Setting_MinImageSize) { // Reisze images smaller than min size to min size AutomaticallyZoomed = true; Zoom(Config.Setting_MinImageSize / Math.Min(Image.Texture.Size.X, Image.Texture.Size.Y), true); } // Center image or place in top-left corner if it's a large/wide image. IntRect currentWorkingArea; if (!FitToMonitorHeightForced) { currentWorkingArea = ImageViewerUtils.GetCurrentWorkingArea(imagePos); } else { currentWorkingArea = currentBounds; } if (Config.Setting_PositionLargeWideImagesInCorner && Image.Texture.Size.X * CurrentZoom > Image.Texture.Size.Y * CurrentZoom && Image.Texture.Size.X * CurrentZoom >= currentWorkingArea.Width) { NextWindowPos = new Vector2i(currentWorkingArea.Left, currentWorkingArea.Top); } else { NextWindowPos = new Vector2i(currentWorkingArea.Left + (currentWorkingArea.Width / 2) - ((int)(Image.Texture.Size.X * CurrentZoom) / 2), currentWorkingArea.Top + (currentWorkingArea.Height / 2) - ((int)(Image.Texture.Size.Y * CurrentZoom) / 2)); } // Force Always on Top? if (FitToMonitorHeightForced || (Image.Texture.Size.Y >= currentBounds.Height && Image.Texture.Size.X < currentBounds.Width)) { ForceAlwaysOnTopNextTick = true; } }
public void ToggleFitToMonitor(int dimension) { UnforceAlwaysOnTop(); IntRect bounds; if (FitToMonitorAlt) { bounds = ImageViewerUtils.GetCurrentWorkingArea(Mouse.GetPosition()); } else { bounds = ImageViewerUtils.GetCurrentBounds(Mouse.GetPosition()); } if (CurrentZoom == 1) { // Fit to Monitor Height if (dimension == Config.AUTO) { if (bounds.Height < bounds.Width) { dimension = Config.HEIGHT; } else { dimension = Config.WIDTH; } } if (dimension == Config.HEIGHT) { FitToMonitorHeight = true; if (Image.Rotation == 90 || Image.Rotation == 270) { Zoom(1 + (((float)bounds.Height - Image.Texture.Size.X) / Image.Texture.Size.X), true); } else { Zoom(1 + (((float)bounds.Height - Image.Texture.Size.Y) / Image.Texture.Size.Y), true); } NextWindowPos = new Vector2i(NextWindowPos.X, bounds.Top); } else if (dimension == Config.WIDTH) { FitToMonitorWidth = true; if (Image.Rotation == 90 || Image.Rotation == 270) { Zoom(1 + (((float)bounds.Width - Image.Texture.Size.Y) / Image.Texture.Size.Y), true); } else { Zoom(1 + (((float)bounds.Width - Image.Texture.Size.X) / Image.Texture.Size.X), true); } NextWindowPos = new Vector2i(bounds.Left, NextWindowPos.Y); } } else { // Full Size FitToMonitorHeight = false; FitToMonitorWidth = false; Zoom(1, true); NextWindowPos = new Vector2i(NextWindowPos.X < 0 ? 0 : NextWindowPos.X, NextWindowPos.Y < 0 ? 0 : NextWindowPos.Y); } if (CurrentImageSize().X *CurrentZoom >= bounds.Width) { NextWindowPos = new Vector2i(bounds.Left, bounds.Top); // Position Window at 0,0 if the image is large (ie: a Desktop wallpaper) } else if (!FitToMonitorAlt) { ForceAlwaysOnTopNextTick = true; } AutomaticallyZoomed = false; }