Skip to content

Commit 95b38d0

Browse files
committed
Fixed Y of Zoom being flipped on PC
I love maths :D
1 parent 3d22bc7 commit 95b38d0

File tree

6 files changed

+10
-5
lines changed

6 files changed

+10
-5
lines changed

CHANGELOG.MD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 1.2.4
2+
Fixed bug where zoom would be inverted on PC
3+
14
# 1.2.3
25
Added support for Prevter's [Smooth Scroll](https://geode-sdk.org/mods/prevter.smooth-scroll) mod
36
Fixed a bug with on mobile where it wouldn't quite zoom in on where your fingers where

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"id": "bobby_shmurner.zoom",
99
"name": "Zoooom!",
10-
"version": "1.2.3",
10+
"version": "1.2.4",
1111
"developer": "Bobby Shmurner",
1212
"description": "Allows you to zoom while paused!",
1313
"links": {

src/mobile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void AndroidZoomLayer::ccTouchMoved(CCTouch* pTouch, CCEvent* pEvent) {
142142
CCPoint touchDisplacement = ccpSub(movingTouch->getLocation(), anchoredTouch->getLocation());
143143
float scaleDelta = touchDisplacement.normalize().dot(delta) / 100.0f;
144144

145-
zoomPlayLayer(m_playLayer, scaleDelta, m_ZoomAnchor);
145+
zoomPlayLayer(m_playLayer, scaleDelta, m_ZoomAnchor, false);
146146
clampPlayLayerPos(m_playLayer);
147147
}
148148
}

src/utils.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "utils.hpp"
22
using namespace geode::prelude;
33

4-
void zoomPlayLayer(CCNode* playLayer, float delta, CCPoint screenAnchor) {
4+
void zoomPlayLayer(CCNode* playLayer, float delta, CCPoint screenAnchor, bool flipY) {
55
if (!playLayer) return;
66

77
CCSize contentSize = playLayer->getContentSize();
@@ -10,6 +10,8 @@ void zoomPlayLayer(CCNode* playLayer, float delta, CCPoint screenAnchor) {
1010
screenAnchor.y - contentSize.height / 2
1111
);
1212

13+
if (flipY) anchorPoint.y *= -1.0f;
14+
1315
float oldScale = playLayer->getScale();
1416
float newScale;
1517

src/utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ using namespace geode::prelude;
55

66
CCSize getScreenSize();
77
void clampPlayLayerPos(CCNode* playLayer);
8-
void zoomPlayLayer(CCNode* playLayer, float zoom, CCPoint screenAnchor);
8+
void zoomPlayLayer(CCNode* playLayer, float zoom, CCPoint screenAnchor, bool flipY);

src/windows.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void WindowsZoomManager::zoom(float delta) {
5555

5656
CCPoint mouseScreenPos = getMousePosOnScreen();
5757

58-
zoomPlayLayer(playLayer, delta, mouseScreenPos);
58+
zoomPlayLayer(playLayer, delta, mouseScreenPos, true);
5959
onScreenModified();
6060
}
6161

0 commit comments

Comments
 (0)