ПРавильные прямоугольники
This commit is contained in:
@@ -101,6 +101,9 @@ pub fn updateVisibleImageRect(self: *Canvas, viewport: dvui.Rect, scroll_offset:
|
||||
changed |= next.x != vis.x or next.y != vis.y or next.w != vis.w or next.h != vis.h;
|
||||
}
|
||||
self._visible_rect = next;
|
||||
if (changed) {
|
||||
std.debug.print("Visible Image Rect: {{ x: {}, y: {}, w: {}, h: {} }}\n", .{ next.x, next.y, next.w, next.h });
|
||||
}
|
||||
if (changed or self.texture == null) {
|
||||
try self.redrawExample();
|
||||
}
|
||||
@@ -123,7 +126,7 @@ fn computeVisibleImageRect(self: Canvas, viewport: dvui.Rect, scroll_offset: dvu
|
||||
const vis_x: u32 = @intCast(std.math.clamp(raw_x, 0, @as(i64, img_w) - @as(i64, vis_w)));
|
||||
const vis_y: u32 = @intCast(std.math.clamp(raw_y, 0, @as(i64, img_h) - @as(i64, vis_h)));
|
||||
|
||||
return .{
|
||||
return ImageRect{
|
||||
.x = vis_x,
|
||||
.y = vis_y,
|
||||
.w = vis_w,
|
||||
|
||||
Reference in New Issue
Block a user