#6367 Tangent snapping improvements (#6369)

* fix snapping line being culled

* make snap line more grayed out

* make snapping tolerance smaller
This commit is contained in:
Andrew Varga
2025-04-17 14:26:05 +02:00
committed by GitHub
parent 16bbc970ae
commit bab79331cb
2 changed files with 5 additions and 3 deletions

View File

@ -2672,8 +2672,8 @@ export class SceneEntities {
if (prev && ARC_SEGMENT_TYPES.includes(prev.userData.type)) { if (prev && ARC_SEGMENT_TYPES.includes(prev.userData.type)) {
const snapDirection = findTangentDirection(prev) const snapDirection = findTangentDirection(prev)
if (snapDirection) { if (snapDirection) {
const SNAP_TOLERANCE_PIXELS = 12 * window.devicePixelRatio const SNAP_TOLERANCE_PIXELS = 8 * window.devicePixelRatio
const SNAP_MIN_DISTANCE_PIXELS = 5 * window.devicePixelRatio const SNAP_MIN_DISTANCE_PIXELS = 10 * window.devicePixelRatio
const orthoFactor = orthoScale(this.sceneInfra.camControls.camera) const orthoFactor = orthoScale(this.sceneInfra.camControls.camera)
// See if snapDirection intersects with any of the axes // See if snapDirection intersects with any of the axes

View File

@ -221,7 +221,7 @@ class StraightSegment implements SegmentUtils {
const snapLine = createLine({ const snapLine = createLine({
from: [0, 0], from: [0, 0],
to: [0, 0], to: [0, 0],
color: 0xcccccc, color: 0x555555,
}) })
snapLine.name = STRAIGHT_SEGMENT_SNAP_LINE snapLine.name = STRAIGHT_SEGMENT_SNAP_LINE
segmentGroup.add(snapLine) segmentGroup.add(snapLine)
@ -294,6 +294,8 @@ class StraightSegment implements SegmentUtils {
if (snapLine) { if (snapLine) {
snapLine.visible = !!input.snap snapLine.visible = !!input.snap
if (snapLine.visible) { if (snapLine.visible) {
// Without this three.js incorrectly culls the line in some cases when zoomed in too much
snapLine.frustumCulled = false
const snapLineFrom = to const snapLineFrom = to
const snapLineTo = new Vector3(to[0], to[1], 0).addScaledVector( const snapLineTo = new Vector3(to[0], to[1], 0).addScaledVector(
dir, dir,