Skip to content

fix: Modified the scale factor of clicks#10

Open
jackfruitdog wants to merge 1 commit intoswe-productivity:masterfrom
jackfruitdog:fix-small-select-tool-click-target
Open

fix: Modified the scale factor of clicks#10
jackfruitdog wants to merge 1 commit intoswe-productivity:masterfrom
jackfruitdog:fix-small-select-tool-click-target

Conversation

@jackfruitdog
Copy link

My apologies. This is the same commit from before, just with tests. I added tests after the fact and ended messing up the commit history. So I had to resubmit.
Closes #8
Used the scale factor of the viewport in order to modify the size of each click.

Recording 2026-01-21 at 18 47 20

@timon-schelling timon-schelling force-pushed the master branch 2 times, most recently from fce5cc1 to 1e8e6f8 Compare February 5, 2026 09:40
self.intersect_path(|| inflated_quad.to_lines(), layer_transform)
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run fmt

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

assert!(cache.try_read(rotation2, scale, translation, fp2).is_none());
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the error messages sligtly more meaningfull.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/// Does the click target intersect the point (accounting for stroke size)
pub fn intersect_point(&self, point: DVec2, layer_transform: DAffine2) -> bool {
let target_bounds = [point - DVec2::splat(self.stroke_width / 2.), point + DVec2::splat(self.stroke_width / 2.)];
const MINIMUM_INFLATION: f64 = 5.;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be moved to editor/src/consts.rs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I put MINIMUM_INFLATION in editor/src/consts.rs, then I need to add the editor as a dependency for vector-types. When I tried to do this, I got a cyclic dependency error as vector-types are obviously a dependency of the editor. Am I missing something? Also I noticed that other files in vector-types have constants declared in file in the same way.

let target_bounds = [point - DVec2::splat(self.stroke_width / 2.), point + DVec2::splat(self.stroke_width / 2.)];
const MINIMUM_INFLATION: f64 = 5.;
let base_inflation = self.stroke_width / 2.;
let target_bounds = match base_inflation < MINIMUM_INFLATION {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would replace this with if

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

let translation = DVec2::new(20., 30.);
let transform = DAffine2::from_scale_angle_translation(scale, rotation, translation);

let point_one = transform.transform_point2(DVec2::new(100., 50.));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefere point1 etc.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@timon-schelling timon-schelling self-assigned this Feb 5, 2026
@jackfruitdog jackfruitdog force-pushed the fix-small-select-tool-click-target branch from 3e0cb51 to 298a6b2 Compare February 10, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Small click target when dragging/moving a straight line or small objects

2 participants