MMB Panning
Added MMB panning to VisjectSurfaces (materials/etc).
This commit is contained in:
@@ -213,6 +213,21 @@ namespace FlaxEditor.Surface
|
||||
return;
|
||||
}
|
||||
|
||||
if (_middleMouseDown) {
|
||||
// Calculate delta
|
||||
var delta = location - _middleMouseDownPos;
|
||||
if (delta.LengthSquared > 0.01f) {
|
||||
// Move view
|
||||
_mouseMoveAmount += delta.Length;
|
||||
_rootControl.Location += delta;
|
||||
_middleMouseDownPos = location;
|
||||
Cursor = CursorType.SizeAll;
|
||||
}
|
||||
|
||||
// Handled
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if user is selecting or moving node(s)
|
||||
if (_leftMouseDown)
|
||||
{
|
||||
@@ -269,6 +284,10 @@ namespace FlaxEditor.Surface
|
||||
_rightMouseDown = false;
|
||||
Cursor = CursorType.Default;
|
||||
}
|
||||
if (_middleMouseDown) {
|
||||
_middleMouseDown = false;
|
||||
Cursor = CursorType.Default;
|
||||
}
|
||||
_isMovingSelection = false;
|
||||
ConnectingEnd(null);
|
||||
|
||||
@@ -380,6 +399,7 @@ namespace FlaxEditor.Surface
|
||||
_isMovingSelection = false;
|
||||
_rightMouseDown = false;
|
||||
_leftMouseDown = false;
|
||||
_middleMouseDown = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -398,6 +418,12 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
_rightMouseDown = true;
|
||||
_rightMouseDownPos = location;
|
||||
Debug.Log("The right mouse button is down in a window");
|
||||
}
|
||||
if (button == MouseButton.Middle) {
|
||||
_middleMouseDown = true;
|
||||
_middleMouseDownPos = location;
|
||||
Debug.Log("The middle mouse button is down in a window");
|
||||
}
|
||||
|
||||
// Check if any node is under the mouse
|
||||
@@ -444,7 +470,7 @@ namespace FlaxEditor.Surface
|
||||
Focus();
|
||||
return true;
|
||||
}
|
||||
if (_rightMouseDown)
|
||||
if (_rightMouseDown || _middleMouseDown)
|
||||
{
|
||||
// Start navigating
|
||||
StartMouseCapture();
|
||||
@@ -513,6 +539,12 @@ namespace FlaxEditor.Surface
|
||||
}
|
||||
_mouseMoveAmount = 0;
|
||||
}
|
||||
if (_middleMouseDown && button == MouseButton.Middle) {
|
||||
_middleMouseDown = false;
|
||||
EndMouseCapture();
|
||||
Cursor = CursorType.Default;
|
||||
_mouseMoveAmount = 0;
|
||||
}
|
||||
|
||||
// Base
|
||||
bool handled = base.OnMouseUp(location, button);
|
||||
@@ -523,6 +555,7 @@ namespace FlaxEditor.Surface
|
||||
// Clear flags
|
||||
_rightMouseDown = false;
|
||||
_leftMouseDown = false;
|
||||
_middleMouseDown = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,11 @@ namespace FlaxEditor.Surface
|
||||
/// </summary>
|
||||
protected bool _rightMouseDown;
|
||||
|
||||
/// <summary>
|
||||
/// The middle mouse down flag.
|
||||
/// </summary>
|
||||
protected bool _middleMouseDown;
|
||||
|
||||
/// <summary>
|
||||
/// The left mouse down position.
|
||||
/// </summary>
|
||||
@@ -69,6 +74,11 @@ namespace FlaxEditor.Surface
|
||||
/// </summary>
|
||||
protected Float2 _rightMouseDownPos = Float2.Minimum;
|
||||
|
||||
/// <summary>
|
||||
/// The middle mouse down position.
|
||||
/// </summary>
|
||||
protected Float2 _middleMouseDownPos = Float2.Minimum;
|
||||
|
||||
/// <summary>
|
||||
/// The mouse position.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user