Handle view centering properly when drag-panning and zooming.
This commit is contained in:
parent
f2fcd4b8e1
commit
c1ea90abc6
|
@ -808,7 +808,7 @@ void WX_VIEW_CONTROLS::WarpMouseCursor( const VECTOR2D& aPosition, bool aWorldCo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WX_VIEW_CONTROLS::CenterOnCursor() const
|
void WX_VIEW_CONTROLS::CenterOnCursor()
|
||||||
{
|
{
|
||||||
const VECTOR2I& screenSize = m_view->GetGAL()->GetScreenPixelSize();
|
const VECTOR2I& screenSize = m_view->GetGAL()->GetScreenPixelSize();
|
||||||
VECTOR2I screenCenter( screenSize / 2 );
|
VECTOR2I screenCenter( screenSize / 2 );
|
||||||
|
@ -816,7 +816,8 @@ void WX_VIEW_CONTROLS::CenterOnCursor() const
|
||||||
if( GetMousePosition( false ) != screenCenter )
|
if( GetMousePosition( false ) != screenCenter )
|
||||||
{
|
{
|
||||||
m_view->SetCenter( GetCursorPosition() );
|
m_view->SetCenter( GetCursorPosition() );
|
||||||
KIPLATFORM::UI::WarpPointer( m_parentPanel, KiROUND( screenSize.x / 2 ), KiROUND( screenSize.y / 2 ) );
|
m_dragStartPoint = screenCenter;
|
||||||
|
KIPLATFORM::UI::WarpPointer( m_parentPanel, screenCenter.x, screenCenter.y );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -354,7 +354,7 @@ public:
|
||||||
* Set the viewport center to the current cursor position and warps the cursor to the
|
* Set the viewport center to the current cursor position and warps the cursor to the
|
||||||
* screen center.
|
* screen center.
|
||||||
*/
|
*/
|
||||||
virtual void CenterOnCursor() const = 0;
|
virtual void CenterOnCursor() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restore the default VIEW_CONTROLS settings.
|
* Restore the default VIEW_CONTROLS settings.
|
||||||
|
|
|
@ -100,7 +100,7 @@ public:
|
||||||
bool aWarpView = false ) override;
|
bool aWarpView = false ) override;
|
||||||
|
|
||||||
///< @copydoc VIEW_CONTROLS::CenterOnCursor()
|
///< @copydoc VIEW_CONTROLS::CenterOnCursor()
|
||||||
void CenterOnCursor() const override;
|
void CenterOnCursor() override;
|
||||||
|
|
||||||
///< Adjusts the scrollbars position to match the current viewport.
|
///< Adjusts the scrollbars position to match the current viewport.
|
||||||
void UpdateScrollbars();
|
void UpdateScrollbars();
|
||||||
|
|
Loading…
Reference in New Issue