Классный зум
This commit is contained in:
@@ -99,6 +99,11 @@ pub fn addZoom(self: *Canvas, value: f32) void {
|
||||
self._zoom = @max(self._zoom, 0.01);
|
||||
}
|
||||
|
||||
pub fn multZoom(self: *Canvas, value: f32) void {
|
||||
self._zoom *= value;
|
||||
self._zoom = @max(self._zoom, 0.01);
|
||||
}
|
||||
|
||||
pub fn getZoom(self: Canvas) f32 {
|
||||
return self._zoom;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,8 @@ fn handleCanvasZoom(canvas: *Canvas, scroll: anytype) void {
|
||||
};
|
||||
const doc_pt = canvas.contentPointToDocument(content_pt, natural_scale);
|
||||
|
||||
canvas.addZoom(y / 1000);
|
||||
// canvas.addZoom(y / 1000);
|
||||
canvas.multZoom(1 + y / 3000);
|
||||
canvas.requestRedraw();
|
||||
|
||||
// Сдвигаем viewport так, чтобы точка под курсором (даже вне холста) не уезжала
|
||||
|
||||
Reference in New Issue
Block a user