Fix inability to drag axis-aligned lines (#2561)

* Fix 1 and 3

* Fix 2

* Shape tools refactor

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
mTvare
2025-04-13 03:51:40 -07:00
committed by GitHub
co-authored by Keavon Chambers
parent fdff5d4e5e
commit 3e6021fb8f
4 changed files with 9 additions and 6 deletions
@@ -35,7 +35,7 @@ impl Default for Pivot {
impl Pivot {
/// Calculates the transform that gets from normalized pivot to viewspace.
fn get_layer_pivot_transform(layer: LayerNodeIdentifier, document: &DocumentMessageHandler) -> DAffine2 {
let [min, max] = document.metadata().nonzero_bounding_box(layer);
let [min, max] = document.metadata().bounding_box_with_transform(layer, DAffine2::IDENTITY).unwrap_or_default();
let bounds_transform = DAffine2::from_translation(min) * DAffine2::from_scale(max - min);
let layer_transform = document.metadata().transform_to_viewport(layer);
@@ -794,7 +794,7 @@ impl BoundingBoxManager {
}
match edges {
Some((top, bottom, left, right)) if !self.is_bounds_flat() => match (top, bottom, left, right) {
Some((top, bottom, left, right)) => match (top, bottom, left, right) {
(true, _, false, false) | (_, true, false, false) => MouseCursorIcon::NSResize,
(false, false, true, _) | (false, false, _, true) => MouseCursorIcon::EWResize,
(true, _, true, _) | (_, true, _, true) => MouseCursorIcon::NWSEResize,