Skip to content

Commit 389ce04

Browse files
jasonstrattonclaude
andcommitted
DYN-6738: Fix gizmo redraw and camera drift issues
Fixes two issues with gizmo manipulation: 1. Gizmo redraw failure during drag - fixed by adding forceAsyncCall=true to render queue 2. Camera drift when zoomed in - fixed by filtering mouse events and clearing stale hit state Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent e883c6f commit 389ce04

File tree

3 files changed

+481
-2
lines changed

3 files changed

+481
-2
lines changed

src/DynamoManipulation/NodeManipulator.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,21 @@ protected virtual void MouseDown(object sender, MouseButtonEventArgs mouseButton
185185
{
186186
if (!IsValidNode) return;
187187

188+
// Skip processing if user is panning or orbiting the camera.
189+
// This prevents the manipulator from capturing mouse events intended for camera navigation.
190+
if (BackgroundPreviewViewModel is DefaultWatch3DViewModel viewModel)
191+
{
192+
if (viewModel.IsPanning || viewModel.IsOrbiting)
193+
return;
194+
}
195+
196+
// Only process left mouse button presses for gizmo manipulation
197+
// Right/middle button presses are for camera navigation (pan/orbit)
198+
if (mouseButtonEventArgs.ChangedButton != MouseButton.Left)
199+
{
200+
return;
201+
}
202+
188203
active = UpdatePosition();
189204
if (Origin != null )
190205
{
@@ -228,6 +243,21 @@ protected virtual void MouseDown(object sender, MouseButtonEventArgs mouseButton
228243
/// <param name="e"></param>
229244
protected virtual void MouseUp(object sender, MouseButtonEventArgs e)
230245
{
246+
// Skip processing if user is panning or orbiting the camera.
247+
// This prevents the manipulator from capturing mouse events intended for camera navigation.
248+
if (BackgroundPreviewViewModel is DefaultWatch3DViewModel viewModel)
249+
{
250+
if (viewModel.IsPanning || viewModel.IsOrbiting)
251+
return;
252+
}
253+
254+
// Only process left mouse button releases for gizmo manipulation
255+
// Right/middle button releases are for camera navigation (pan/orbit)
256+
if (e.ChangedButton != MouseButton.Left)
257+
{
258+
return;
259+
}
260+
231261
GizmoInAction = null;
232262

233263
if (originBeforeMove != null && originAfterMove != null)
@@ -249,6 +279,13 @@ protected virtual void MouseUp(object sender, MouseButtonEventArgs e)
249279
foreach (var gizmo in gizmos)
250280
{
251281
gizmo.UpdateGizmoGraphics();
282+
283+
// Clear hit state to prevent drift during subsequent camera operations
284+
// This ensures stale axis/plane hit data doesn't affect pan/orbit movements
285+
if (gizmo is TranslationGizmo translationGizmo)
286+
{
287+
translationGizmo.ClearHitState();
288+
}
252289
}
253290
}
254291

@@ -286,7 +323,7 @@ protected virtual void MouseMove(object sender, MouseEventArgs mouseEventArgs)
286323

287324
// redraw manipulator at new position synchronously
288325
var packages = BuildRenderPackage();
289-
BackgroundPreviewViewModel.AddGeometryForRenderPackages(packages);
326+
BackgroundPreviewViewModel.AddGeometryForRenderPackages(packages, true);
290327
}
291328

292329
/// <summary>

src/DynamoManipulation/TranslationGizmo.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,17 @@ private Line GetRayGeometry(Point source, Vector direction)
276276
public CoordinateSystem ReferenceCoordinateSystem { get; set; }
277277

278278
/// <summary>
279-
/// Performs hit test on Gizmo to find out hit object. The returned
279+
/// Clears the cached hit axis and plane after manipulation is complete.
280+
/// This prevents stale hit state from affecting subsequent camera operations.
281+
/// </summary>
282+
public void ClearHitState()
283+
{
284+
hitAxis = null;
285+
hitPlane = null;
286+
}
287+
288+
/// <summary>
289+
/// Performs hit test on Gizmo to find out hit object. The returned
280290
/// hitObject could be either axis vector or a plane.
281291
/// </summary>
282292
/// <param name="source">Mouse click source for hit test</param>

0 commit comments

Comments
 (0)