This repository was archived by the owner on Apr 29, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -260,13 +260,15 @@ void handleMouseScroll() {
260
260
}
261
261
262
262
int getMouseButtonDown ( ) {
263
+ //default mouse button key = left mouse button
264
+ var defaultKey = 0 ;
263
265
for ( int key = 0 ; key < mouseButtonNum ; key ++ ) {
264
266
if ( Input . GetMouseButton ( key ) ) {
265
- return InputUtils . getMouseButtonKey ( key ) ;
267
+ defaultKey = key ;
268
+ break ;
266
269
}
267
270
}
268
-
269
- return 0 ;
271
+ return InputUtils . getMouseButtonKey ( defaultKey ) ;
270
272
}
271
273
272
274
public void OnPointerDown ( PointerEventData eventData ) {
Original file line number Diff line number Diff line change @@ -103,6 +103,16 @@ public PointerHoverEvent(
103
103
position : position ,
104
104
down : false ) {
105
105
}
106
+
107
+ public static PointerHoverEvent fromHoverEvent ( PointerEvent hover ) {
108
+ return new PointerHoverEvent (
109
+ timeStamp : hover . timeStamp ,
110
+ pointer : hover . pointer ,
111
+ kind : hover . kind ,
112
+ device : hover . device ,
113
+ position : hover . position
114
+ ) ;
115
+ }
106
116
}
107
117
108
118
public class PointerEnterEvent : PointerEvent {
@@ -121,7 +131,7 @@ public PointerEnterEvent(
121
131
down : false ) {
122
132
}
123
133
124
- public static PointerEnterEvent fromHoverEvent ( PointerHoverEvent hover ) {
134
+ public static PointerEnterEvent fromHoverEvent ( PointerEvent hover ) {
125
135
return new PointerEnterEvent (
126
136
timeStamp : hover . timeStamp ,
127
137
pointer : hover . pointer ,
Original file line number Diff line number Diff line change @@ -171,12 +171,12 @@ void exitAllDevices(_TrackedAnnotation trackedAnnotation) {
171
171
if ( ! hitAnnotation . activeDevices . Contains ( deviceId ) ) {
172
172
hitAnnotation . activeDevices . Add ( deviceId ) ;
173
173
if ( hitAnnotation . annotation ? . onEnter != null ) {
174
- hitAnnotation . annotation . onEnter ( PointerEnterEvent . fromHoverEvent ( ( PointerHoverEvent ) lastEvent ) ) ;
174
+ hitAnnotation . annotation . onEnter ( PointerEnterEvent . fromHoverEvent ( lastEvent ) ) ;
175
175
}
176
176
}
177
177
178
178
if ( hitAnnotation . annotation ? . onHover != null ) {
179
- hitAnnotation . annotation . onHover ( ( PointerHoverEvent ) lastEvent ) ;
179
+ hitAnnotation . annotation . onHover ( PointerHoverEvent . fromHoverEvent ( lastEvent ) ) ;
180
180
}
181
181
182
182
foreach ( _TrackedAnnotation trackedAnnotation in this . _trackedAnnotations . Values ) {
You can’t perform that action at this time.
0 commit comments