Is it ok to add tolerance for snap points?
-
Re: [Plugin] BezierSpline - v2.2a - 22 Apr 21
I made a change like this if you don't minddef pick_point_to_move(x, y, view) tolerance = 1000 # Tolerans değeri, piksel cinsinden @old_pt_to_move = @pt_to_move ph = view.pick_helper @selection = ph.pick_segment @pts, x, y if @selection if @selection < 0 # Segment üzerinde bir nokta bulduysak pickray = view.pickray x, y i = -@selection segment = [@pts[i-1], @pts[i]] result = Geom.closest_points(segment, pickray) # Yakınlık kontrolü if result[0].distance(@pts[i-1]) <= tolerance || result[0].distance(@pts[i]) <= tolerance @pt_to_move = result[0] else @pt_to_move = nil end else # Kontrol noktasını bulduysak @pt_to_move = @pts[@selection] end else @pt_to_move = nil end @old_pt_to_move != @pt_to_move end
Advertisement