Skip to content

Commit e969898

Browse files
committed
fix inverted deltaX/Y calculation, mltiple mouse actions by 3.5 to match unified remote app
1 parent 81555c3 commit e969898

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

dist/universal-remote-card.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/classes/remote-button.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ export class RemoteButton extends BaseRemoteElement {
160160
currentY = e.clientY;
161161
}
162162

163-
this.deltaX = (this.initialX ?? currentX) - currentX;
164-
this.deltaY = (this.initialY ?? currentY) - currentY;
163+
this.deltaX = currentX - (this.initialX ?? currentX);
164+
this.deltaY = currentY - (this.initialY ?? currentY);
165165

166166
// Only consider significant enough movement
167167
const sensitivity = 24;

src/classes/remote-mousepad.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ export class RemoteMousepad extends RemoteTouchpad {
6666
currentY = e.clientY ?? 0;
6767
}
6868

69-
this.deltaX = this.initialX - currentX;
70-
this.deltaY = this.initialY - currentY;
69+
this.deltaX = currentX - this.initialX;
70+
this.deltaY = currentY - this.initialY;
7171
this.initialX = currentX;
7272
this.initialY = currentY;
7373
console.log(`${this.deltaX},${this.deltaY}`);

src/classes/remote-touchpad.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ export class RemoteTouchpad extends BaseRemoteElement {
180180
currentY = e.clientY ?? 0;
181181
}
182182

183-
this.deltaX = this.initialX - currentX;
184-
this.deltaY = this.initialY - currentY;
183+
this.deltaX = currentX - this.initialX;
184+
this.deltaY = currentY - this.initialY;
185185

186186
// Only consider significant enough movement
187187
const sensitivity = 2;

src/models/maps/unified_remote/defaultKeys.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ export const unifiedRemoteDefaultKeys: IElementConfig[] = [
146146
Value: 0,
147147
},
148148
{
149-
Value: '{{ deltaX }}',
149+
Value: '{{ 3.5 * deltaX }}',
150150
},
151151
{
152-
Value: '{{ deltaY }}',
152+
Value: '{{ 3.5 * deltaY }}',
153153
},
154154
],
155155
},
@@ -167,10 +167,10 @@ export const unifiedRemoteDefaultKeys: IElementConfig[] = [
167167
Value: 0,
168168
},
169169
{
170-
Value: '{{ deltaX }}',
170+
Value: '{{ 3.5 * deltaX }}',
171171
},
172172
{
173-
Value: '{{ deltaY }}',
173+
Value: '{{ 3.5 * deltaY }}',
174174
},
175175
],
176176
},

0 commit comments

Comments
 (0)