Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/reference_viewer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ ReferenceViewer.createViewer = function(title)
-- Updates the value of the slider with the actual value of scale_factor.
dlg:modify{id="scale_slider", value=scale_factor*100}

-- Clamp image position to avoid showing empty areas.
local min_display_pixels = 2 * inv_scale_factor
image_pos.x = math.max(image_pos.x, -gc.width * inv_scale_factor + min_display_pixels)
image_pos.x = math.min(image_pos.x, active_image.width - min_display_pixels)
image_pos.y = math.max(image_pos.y, -gc.height * inv_scale_factor + min_display_pixels)
image_pos.y = math.min(image_pos.y, active_image.height - min_display_pixels)

local image
-- When we zoom-in (scale_factor > fit_scale) we only
-- see a part of the image. We only copy what is visible
Expand Down