mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-28 19:08:12 +08:00
Round document alignment in viewport to avoid AA induced by a shift after zooming in and panning (#921)
This commit is contained in:
committed by
Keavon Chambers
parent
0c9f457866
commit
002b0fc1dd
@@ -307,11 +307,15 @@ impl NavigationMessageHandler {
|
||||
}
|
||||
|
||||
pub fn calculate_offset_transform(&self, offset: DVec2) -> DAffine2 {
|
||||
// Try to avoid fractional coordinates to reduce anti aliasing.
|
||||
let scale = self.snapped_scale();
|
||||
let rounded_pan = ((self.pan + offset) * scale).round() / scale - offset;
|
||||
|
||||
// TODO: replace with DAffine2::from_scale_angle_translation and fix the errors
|
||||
let offset_transform = DAffine2::from_translation(offset);
|
||||
let scale_transform = DAffine2::from_scale(DVec2::splat(self.snapped_scale()));
|
||||
let scale_transform = DAffine2::from_scale(DVec2::splat(scale));
|
||||
let angle_transform = DAffine2::from_angle(self.snapped_angle());
|
||||
let translation_transform = DAffine2::from_translation(self.pan);
|
||||
let translation_transform = DAffine2::from_translation(rounded_pan);
|
||||
scale_transform * offset_transform * angle_transform * translation_transform
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user