Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion node-graph/libraries/vector-types/src/vector/click_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,18 @@ impl ClickTarget {

/// 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.)];
//Maintain minimum 5px viewport stroke while calculating intersection point
const MIN_VIEW : f64 = 5.0;
//scaling factor for converting to viewpoint space
let scale: f64 = layer_transform.x_axis.length().max(layer_transform.y_axis.length());
let stroke_view : f64 = scale * self.stroke_width;
let inflated_stroke: f64 = if stroke_view < MIN_VIEW{
MIN_VIEW/scale
}
else{
self.stroke_width
};
let target_bounds = [point - DVec2::splat(inflated_stroke / 2.), point + DVec2::splat(inflated_stroke / 2.)];
let intersects = |a: [DVec2; 2], b: [DVec2; 2]| a[0].x <= b[1].x && a[1].x >= b[0].x && a[0].y <= b[1].y && a[1].y >= b[0].y;
// This bounding box is not very accurate as it is the axis aligned version of the transformed bounding box. However it is fast.
if !self
Expand Down