mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Merge pull request #12567 from iota97/snap2
Use snap grid on resize as well
This commit is contained in:
1 file changed
+6
-1
@@ -288,6 +288,11 @@ bool TouchControlLayoutScreen::touch(const TouchInput &touch) {
|
||||
float diffX = (touch.x - startX_);
|
||||
float diffY = -(touch.y - startY_);
|
||||
|
||||
// Snap to grid
|
||||
if (g_Config.bTouchSnapToGrid) {
|
||||
diffX -= (int)(touch.x - startX_) % (g_Config.iTouchSnapGridSize/2);
|
||||
diffY += (int)(touch.y - startY_) % (g_Config.iTouchSnapGridSize/2);
|
||||
}
|
||||
float movementScale = 0.02f;
|
||||
float newScale = startScale_ + diffY * movementScale;
|
||||
float newSpacing = startSpacing_ + diffX * movementScale;
|
||||
@@ -363,7 +368,7 @@ void TouchControlLayoutScreen::CreateViews() {
|
||||
// ->OnChange.Handle(this, &GameSettingsScreen::OnChangeControlScaling);
|
||||
|
||||
CheckBox *snap = new CheckBox(&g_Config.bTouchSnapToGrid, di->T("Snap"), "", new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 228));
|
||||
PopupSliderChoice *gridSize = new PopupSliderChoice(&g_Config.iTouchSnapGridSize, 1, 256, di->T("Grid"), screenManager(), "", new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 158));
|
||||
PopupSliderChoice *gridSize = new PopupSliderChoice(&g_Config.iTouchSnapGridSize, 2, 256, di->T("Grid"), screenManager(), "", new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 158));
|
||||
gridSize->SetEnabledPtr(&g_Config.bTouchSnapToGrid);
|
||||
|
||||
mode_ = new ChoiceStrip(ORIENT_VERTICAL, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 140 + 158 + 64 + 10));
|
||||
|
||||
Reference in new issue
Block a user