@@ -14,13 +14,13 @@ static void MouseDownEvent (NUIE::NodeEditor* nodeEditor, NSEvent* event, NUIE::
14
14
}
15
15
}
16
16
17
- @interface CocoaNSViewControl : NSView
17
+ @interface EditorView : NSView
18
18
{
19
19
@private MAS::NodeEditorNSViewControl* nodeEditorControl;
20
20
}
21
21
@end
22
22
23
- @implementation CocoaNSViewControl
23
+ @implementation EditorView
24
24
25
25
- (BOOL ) acceptsFirstResponder
26
26
{
@@ -49,6 +49,9 @@ - (void) drawRect : (NSRect) dirtyRect
49
49
50
50
- (void ) mouseDown : (NSEvent *) event
51
51
{
52
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
53
+ return ;
54
+ }
52
55
NUIE::Point position = MAS::GetViewPositionFromEvent (self, event);
53
56
NUIE::NodeEditor* nodeEditor = nodeEditorControl->GetNodeEditor ();
54
57
if ([event modifierFlags ] & NSEventModifierFlagControl) {
@@ -60,62 +63,89 @@ - (void) mouseDown : (NSEvent*) event
60
63
61
64
- (void ) mouseUp : (NSEvent *) event
62
65
{
66
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
67
+ return ;
68
+ }
63
69
NUIE::Point position = MAS::GetViewPositionFromEvent (self, event);
64
70
NUIE::NodeEditor* nodeEditor = nodeEditorControl->GetNodeEditor ();
65
71
nodeEditor->OnMouseUp (MAS::GetModifierKeysFromEvent (event), NUIE::MouseButton::Left, position.GetX (), position.GetY ());
66
72
}
67
73
68
74
- (void ) rightMouseDown : (NSEvent *) event
69
75
{
76
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
77
+ return ;
78
+ }
70
79
NUIE::Point position = MAS::GetViewPositionFromEvent (self, event);
71
80
NUIE::NodeEditor* nodeEditor = nodeEditorControl->GetNodeEditor ();
72
81
MouseDownEvent (nodeEditor, event, NUIE::MouseButton::Right, position.GetX (), position.GetY ());
73
82
}
74
83
75
84
- (void ) rightMouseUp : (NSEvent *) event
76
85
{
86
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
87
+ return ;
88
+ }
77
89
NUIE::Point position = MAS::GetViewPositionFromEvent (self, event);
78
90
NUIE::NodeEditor* nodeEditor = nodeEditorControl->GetNodeEditor ();
79
91
nodeEditor->OnMouseUp (MAS::GetModifierKeysFromEvent (event), NUIE::MouseButton::Right, position.GetX (), position.GetY ());
80
92
}
81
93
82
94
- (void ) otherMouseDown : (NSEvent *) event
83
95
{
96
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
97
+ return ;
98
+ }
84
99
NUIE::Point position = MAS::GetViewPositionFromEvent (self, event);
85
100
NUIE::NodeEditor* nodeEditor = nodeEditorControl->GetNodeEditor ();
86
101
MouseDownEvent (nodeEditor, event, NUIE::MouseButton::Middle, position.GetX (), position.GetY ());
87
102
}
88
103
89
104
- (void ) otherMouseUp : (NSEvent *) event
90
105
{
106
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
107
+ return ;
108
+ }
91
109
NUIE::Point position = MAS::GetViewPositionFromEvent (self, event);
92
110
NUIE::NodeEditor* nodeEditor = nodeEditorControl->GetNodeEditor ();
93
111
nodeEditor->OnMouseUp (MAS::GetModifierKeysFromEvent (event), NUIE::MouseButton::Middle, position.GetX (), position.GetY ());
94
112
}
95
113
96
114
- (void ) mouseDragged : (NSEvent *) event
97
115
{
116
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
117
+ return ;
118
+ }
98
119
NUIE::Point position = MAS::GetViewPositionFromEvent (self, event);
99
120
NUIE::NodeEditor* nodeEditor = nodeEditorControl->GetNodeEditor ();
100
121
nodeEditor->OnMouseMove (MAS::GetModifierKeysFromEvent (event), position.GetX (), position.GetY ());
101
122
}
102
123
103
124
- (void ) rightMouseDragged : (NSEvent *) event
104
125
{
126
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
127
+ return ;
128
+ }
105
129
NUIE::Point position = MAS::GetViewPositionFromEvent (self, event);
106
130
NUIE::NodeEditor* nodeEditor = nodeEditorControl->GetNodeEditor ();
107
131
nodeEditor->OnMouseMove (MAS::GetModifierKeysFromEvent (event), position.GetX (), position.GetY ());
108
132
}
109
133
110
134
- (void ) otherMouseDragged : (NSEvent *) event
111
135
{
136
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
137
+ return ;
138
+ }
112
139
NUIE::Point position = MAS::GetViewPositionFromEvent (self, event);
113
140
NUIE::NodeEditor* nodeEditor = nodeEditorControl->GetNodeEditor ();
114
141
nodeEditor->OnMouseMove (MAS::GetModifierKeysFromEvent (event), position.GetX (), position.GetY ());
115
142
}
116
143
117
144
- (void ) scrollWheel : (NSEvent *) event
118
145
{
146
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
147
+ return ;
148
+ }
119
149
NUIE::NodeEditor* nodeEditor = nodeEditorControl->GetNodeEditor ();
120
150
NUIE::ModifierKeys modifierKeys = MAS::GetModifierKeysFromEvent (event);
121
151
float deltaX = [event scrollingDeltaX ];
@@ -134,6 +164,9 @@ - (void) scrollWheel : (NSEvent*) event
134
164
135
165
- (void ) magnifyWithEvent : (NSEvent *) event
136
166
{
167
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
168
+ return ;
169
+ }
137
170
NUIE::Point position = MAS::GetViewPositionFromEvent (self, event);
138
171
NUIE::MouseWheelRotation rotation = NUIE::MouseWheelRotation::Forward;
139
172
if ([event magnification ] < 0 .0f ) {
@@ -145,12 +178,18 @@ - (void) magnifyWithEvent : (NSEvent*) event
145
178
146
179
- (void ) swipeWithEvent : (NSEvent *) event
147
180
{
181
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
182
+ return ;
183
+ }
148
184
NUIE::NodeEditor* nodeEditor = nodeEditorControl->GetNodeEditor ();
149
185
nodeEditor->OnMouseSwipe (MAS::GetModifierKeysFromEvent (event), [event deltaX ], [event deltaY ]);
150
186
}
151
187
152
188
- (void ) keyDown : (NSEvent *) event
153
189
{
190
+ if (!nodeEditorControl->IsInputHandlingEnabled ()) {
191
+ return ;
192
+ }
154
193
if (!nodeEditorControl->IsMouseOverEditorWindow ()) {
155
194
return ;
156
195
}
@@ -242,8 +281,8 @@ - (void) cursorUpdate : (NSEvent *) theEvent
242
281
@autoreleasepool {
243
282
@try {
244
283
NSRect viewRect = NSMakeRect (x, y, width, height);
245
- nsView = [[CocoaNSViewControl alloc ] initWithFrame : viewRect];
246
- [((CocoaNSViewControl *) nsView) setNodeEditorControl : this];
284
+ nsView = [[EditorView alloc ] initWithFrame : viewRect];
285
+ [((EditorView *) nsView) setNodeEditorControl : this];
247
286
[((NSView *) nativeParentHandle) addSubview : nsView];
248
287
} @catch (NSException *) {
249
288
0 commit comments