@@ -189,7 +189,7 @@ bool CheckInput(EditorActions action)
189189std::string GetInputString (EditorActions action)
190190{
191191 const HotkeyInfo& hotkey = hotkeyActions[size_t (action)];
192- std::string ret = wi::input::ButtonToString (hotkey.button ).text ;
192+ std::string ret = wi::input::ButtonToString (hotkey.button ).chars ;
193193 if (hotkey.shift )
194194 {
195195 ret = " Shift + " + ret;
@@ -1994,16 +1994,19 @@ void EditorComponent::Update(float dt)
19941994 currentMouse.x -= renderPath->PhysicalToLogical ((uint32_t )viewport3D.top_left_x );
19951995 currentMouse.y -= renderPath->PhysicalToLogical ((uint32_t )viewport3D.top_left_y );
19961996
1997+ static constexpr float tweak60 = 0 .1f / 60 .0f ;
19971998 float xDif = 0 , yDif = 0 ;
19981999 const wi::input::MouseState& mouse = wi::input::GetMouseState ();
2000+ const wi::input::Pinch pinch = wi::input::GetTouchPinch ();
2001+ const XMFLOAT2 & pan = wi::input::GetTouchPan ();
19992002
20002003 if (wi::input::Down (wi::input::MOUSE_BUTTON_RIGHT ))
20012004 {
20022005 camControlStart = false ;
20032006 xDif = mouse.delta_position .x ;
20042007 yDif = mouse.delta_position .y ;
2005- xDif = 0 . 1f * xDif * ( 1 . 0f / 60 . 0f ) ;
2006- yDif = 0 . 1f * yDif * ( 1 . 0f / 60 . 0f ) ;
2008+ xDif *= tweak60 ;
2009+ yDif *= tweak60 ;
20072010 if (!is_2D_mode)
20082011 {
20092012 wi::input::SetPointer (originalMouse);
@@ -2041,6 +2044,9 @@ void EditorComponent::Update(float dt)
20412044 const float joystickrotspeed = 0 .05f ;
20422045 xDif += rightStick.x * joystickrotspeed;
20432046 yDif += rightStick.y * joystickrotspeed;
2047+
2048+ xDif += pan.x * tweak60;
2049+ yDif += pan.y * tweak60;
20442050
20452051 xDif *= cameraWnd.rotationspeedSlider .GetValue ();
20462052 yDif *= cameraWnd.rotationspeedSlider .GetValue ();
@@ -2111,13 +2117,18 @@ void EditorComponent::Update(float dt)
21112117
21122118 // Mouse pan works completely differently in 2D mode, it "grabs canvas"
21132119 XMFLOAT2 grabdiff = XMFLOAT2 (0 , 0 );
2120+ const float units_per_pixel = camera.ortho_vertical_size / viewport3D.height * 0 .5f ;
21142121 if (wi::input::Down (wi::input::MOUSE_BUTTON_RIGHT ))
21152122 {
21162123 wi::input::SetCursor (wi::input::CURSOR_RESIZEALL );
2117- const float units_per_pixel = camera.ortho_vertical_size / viewport3D.height * 0 .5f ;
21182124 grabdiff = XMFLOAT2 (-mouse.delta_position .x * units_per_pixel, mouse.delta_position .y * units_per_pixel);
21192125 move = XMVectorZero ();
21202126 }
2127+ else if (std::abs (pan.x ) > 0 .0001f || std::abs (pan.y ) > 0 .0001f )
2128+ {
2129+ grabdiff = XMFLOAT2 (pan.x * units_per_pixel, -pan.y * units_per_pixel);
2130+ move = XMVectorZero ();
2131+ }
21212132
21222133 if (std::abs (grabdiff.x ) > 0 .0001f || std::abs (grabdiff.y ) > 0 .0001f || moveLength > 0 .0001f )
21232134 {
@@ -2133,6 +2144,7 @@ void EditorComponent::Update(float dt)
21332144 {
21342145 camera.ortho_vertical_size -= currentMouse.z ;
21352146 }
2147+ camera.ortho_vertical_size *= 1 .0f + pinch.delta_scale ;
21362148
21372149 camera.ortho_vertical_size = std::max (0 .01f , camera.ortho_vertical_size );
21382150 }
@@ -2154,6 +2166,7 @@ void EditorComponent::Update(float dt)
21542166 if (CheckInput (EditorActions::MOVE_CAMERA_BACKWARD ) || wi::input::Down (wi::input::GAMEPAD_BUTTON_DOWN )) { moveNew += XMVectorSet (0 , 0 , -1 , 0 ); camera.ortho_vertical_size += 0 .1f ; }
21552167 if (CheckInput (EditorActions::MOVE_CAMERA_UP ) || wi::input::Down (wi::input::GAMEPAD_BUTTON_2 )) { moveNew += XMVectorSet (0 , 1 , 0 , 0 ); }
21562168 if (CheckInput (EditorActions::MOVE_CAMERA_DOWN ) || wi::input::Down (wi::input::GAMEPAD_BUTTON_1 )) { moveNew += XMVectorSet (0 , -1 , 0 , 0 ); }
2169+ moveNew += XMVectorSet (0 , 0 , pinch.delta_scale , 0 );
21572170 moveNew = XMVector3Normalize (moveNew);
21582171 }
21592172 moveNew += XMVectorSet (leftStick.x , 0 , leftStick.y , 0 );
0 commit comments