Remove dragging and fix cntrl (hopefully)

master
7kasper 2023-11-29 01:16:42 +01:00
parent a0b42267ff
commit ff4a57de76
No known key found for this signature in database
GPG Key ID: 4AD2FD3E13BFB86A
3 changed files with 6 additions and 15 deletions

View File

@ -9,4 +9,5 @@
0.09: Code cleanup and windows 11 support. 0.09: Code cleanup and windows 11 support.
0.10: Bugfixes. 0.10: Bugfixes.
0.11: Fix mouse move getting stuck. 0.11: Fix mouse move getting stuck.
0.12: Added support for mouse dragging action (click then drag) 0.12: Added support for mouse dragging action (click then drag).
0.13: Removed mouse dragging (too buggy/unuseful).

View File

@ -97,7 +97,6 @@ let homePitch = 0;
let mCal = 0; let mCal = 0;
let mttl = 0; let mttl = 0;
let cttl = 0; let cttl = 0;
let httl = 0;
// BT helper. // BT helper.
let clearToSend = true; let clearToSend = true;
@ -258,14 +257,14 @@ function handleAcc(acc) {
} }
} }
Bangle.on('lock', function(on) { Bangle.on('lock', function(on) {
if (on && holding) { if (on && (holding || trackPadMode)) {
Bangle.setLocked(false); Bangle.setLocked(false);
Bangle.setLCDPower(1); Bangle.setLCDPower(1);
} }
}); });
function startHolding() { function startHolding() {
bt.tapKey(bt.KEY.A, bt.MODIFY.CTRL, () => bt.tapKey(bt.KEY.A, bt.MODIFY.CTRL)); bt.tapKey(0xE0, () => bt.tapKey(0xE0));
holding = true; holding = true;
Bangle.buzz(); Bangle.buzz();
E.showMessage('Holding'); E.showMessage('Holding');
@ -275,7 +274,7 @@ function startHolding() {
function stopHolding() { function stopHolding() {
clearTimeout(timeoutHolding); clearTimeout(timeoutHolding);
if (holding) { if (holding) {
bt.tapKey(0, bt.MODIFY.CTRL); bt.tapKey(0xE0);
// bt.tapKey(bt.KEY.F10); // bt.tapKey(bt.KEY.F10);
homePitch = 0; homePitch = 0;
homeRoll = 0; homeRoll = 0;
@ -295,13 +294,6 @@ function stopHolding() {
Bangle.on('drag', function(e) { Bangle.on('drag', function(e) {
if (cttl == 0) { cttl = getTime(); } if (cttl == 0) { cttl = getTime(); }
if (trackPadMode) { if (trackPadMode) {
// When we are dragging mouse release after small time amount otherwise keep dragging.
if (getTime() - httl < 0.2) {
httl = getTime();
} else if (httl != 0) {
httl = 0;
bt.releaseButton(bt.BUTTON.ALL);
}
if (lastx + lasty == 0) { if (lastx + lasty == 0) {
lastx = e.x; lastx = e.x;
lasty = e.y; lasty = e.y;
@ -330,14 +322,12 @@ Bangle.on('drag', function(e) {
if (getTime() - cttl < 0.2) { if (getTime() - cttl < 0.2) {
bt.holdButton(bt.BUTTON.LEFT); bt.holdButton(bt.BUTTON.LEFT);
console.log("click left"); console.log("click left");
httl = getTime();
clearToSend = true; clearToSend = true;
} }
// longer press in center // longer press in center
else if (getTime() - cttl < 0.6 && e.x > g.getWidth()/4 && e.x < 3 * g.getWidth()/4 && e.y > g.getHeight() / 4 && e.y < 3 * g.getHeight() / 4) { else if (getTime() - cttl < 0.6 && e.x > g.getWidth()/4 && e.x < 3 * g.getWidth()/4 && e.y > g.getHeight() / 4 && e.y < 3 * g.getHeight() / 4) {
bt.holdButton(bt.BUTTON.RIGHT); bt.holdButton(bt.BUTTON.RIGHT);
console.log("click right"); console.log("click right");
httl = getTime();
clearToSend = true; clearToSend = true;
} }
cttl = 0; cttl = 0;

View File

@ -1,7 +1,7 @@
{ {
"id": "presentor", "id": "presentor",
"name": "Presentor", "name": "Presentor",
"version": "0.12", "version": "0.13",
"description": "Use your Bangle to present!", "description": "Use your Bangle to present!",
"icon": "app.png", "icon": "app.png",
"type": "app", "type": "app",