bare-pointer 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/darwin.js +17 -3
  2. package/package.json +2 -1
package/lib/darwin.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const AnimationFrameProvider = require('bare-animation-frame')
2
2
  const AppKitApplication = require('bare-app-kit/application')
3
3
  const AppKitEvent = require('bare-app-kit/event')
4
+ const FoundationProcessInfo = require('bare-foundation/process-info')
4
5
 
5
6
  const { TYPE, MASK } = AppKitEvent
6
7
 
@@ -12,6 +13,7 @@ module.exports = class DarwinPointer {
12
13
  constructor() {
13
14
  this._window = null
14
15
  this._point = null
16
+ this._press = 0
15
17
  }
16
18
 
17
19
  size(view) {
@@ -50,6 +52,8 @@ module.exports = class DarwinPointer {
50
52
  }
51
53
 
52
54
  down(view, x, y) {
55
+ this._press++
56
+
53
57
  this._send(TYPE.LEFT_MOUSE_DOWN, view, x, y)
54
58
  }
55
59
 
@@ -65,8 +69,10 @@ module.exports = class DarwinPointer {
65
69
  const window = view.window
66
70
  const point = view.convertPointToView(x, y, null)
67
71
 
68
- AppKitApplication.postEvent(this._event(TYPE.LEFT_MOUSE_DOWN, window, point))
69
- AppKitApplication.postEvent(this._event(TYPE.LEFT_MOUSE_UP, window, point))
72
+ this._press++
73
+
74
+ AppKitApplication.postEvent(this._event(TYPE.LEFT_MOUSE_UP, window, point), true)
75
+ AppKitApplication.postEvent(this._event(TYPE.LEFT_MOUSE_DOWN, window, point), true)
70
76
  }
71
77
 
72
78
  pending(view) {
@@ -94,6 +100,14 @@ module.exports = class DarwinPointer {
94
100
  }
95
101
 
96
102
  _event(type, window, point) {
97
- return AppKitEvent.mouseEvent(type, point.x, point.y, 0, 0, window.windowNumber)
103
+ return AppKitEvent.mouseEvent(
104
+ type,
105
+ point.x,
106
+ point.y,
107
+ 0,
108
+ FoundationProcessInfo.processInfo.systemUptime,
109
+ window.windowNumber,
110
+ this._press
111
+ )
98
112
  }
99
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-pointer",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Simulated pointer input for testing Bare apps",
5
5
  "exports": {
6
6
  "./package": "./package.json",
@@ -49,6 +49,7 @@
49
49
  "dependencies": {
50
50
  "bare-animation-frame": "^0.1.1",
51
51
  "bare-app-kit": "^0.3.3",
52
+ "bare-foundation": "^0.1.1",
52
53
  "bare-ndk": "^0.3.4",
53
54
  "bare-ui-kit-touch": "^0.1.0",
54
55
  "bare-user32": "^0.1.1",