OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
wxNSCustomOpenGLView(Gesture) Category Reference

Instance Methods

(void) - onGestureMove: [implementation]
(void) - onGestureScale: [implementation]
(void) - onGestureRotate: [implementation]
(void) - postEvent:withGesture: [implementation]
(void) - scrollWheel2: [implementation]
(void) - initGesturesWithHandler: [implementation]

Class Methods

(void) + load [implementation]

Detailed Description

Method Documentation

◆ initGesturesWithHandler:

- (void) initGesturesWithHandler: (wxEvtHandler*) handler
implementation

Extends class wxNSCustomOpenGLView.

448 : (wxEvtHandler*) handler
449{
450// NSPanGestureRecognizer * pan = [[NSPanGestureRecognizer alloc] initWithTarget: self action: @selector(onGestureMove:)];
451// pan.numberOfTouchesRequired = 2;
452// pan.allowedTouchTypes = 0;
453// NSMagnificationGestureRecognizer * magnification = [[NSMagnificationGestureRecognizer alloc] initWithTarget: self action: @selector(onGestureScale:)];
454// NSRotationGestureRecognizer * rotation = [[NSRotationGestureRecognizer alloc] initWithTarget: self action: @selector(onGestureRotate:)];
455// [self addGestureRecognizer:pan];
456// [self addGestureRecognizer:magnification];
457// [self addGestureRecognizer:rotation];
458 objc_setAssociatedObject(self, &gesture_handler_key, handler ? [NSValue valueWithPointer:handler] : nil,
459 OBJC_ASSOCIATION_RETAIN_NONATOMIC);
460 set_scroll_pan_active(self, false);
461}
static char gesture_handler_key
Definition MacDarkMode.mm:356
static void set_scroll_pan_active(NSView *view, bool active)
Definition MacDarkMode.mm:368

References gesture_handler_key, and set_scroll_pan_active().

Here is the call graph for this function:

◆ load

+ (void) load
implementation

Extends class wxNSCustomOpenGLView.

442{
443 Method scrollWheel = class_getInstanceMethod([wxNSCustomOpenGLView class], @selector(scrollWheel:));
444 Method scrollWheel2 = class_getInstanceMethod([wxNSCustomOpenGLView class], @selector(scrollWheel2:));
445 method_exchangeImplementations(scrollWheel, scrollWheel2);
446}
Method
Definition SeamContour.hpp:35

References load.

Referenced by load.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onGestureMove:

- (void) onGestureMove: (NSPanGestureRecognizer*) gesture
implementation

Extends class wxNSCustomOpenGLView.

375 : (NSPanGestureRecognizer*) gesture
376{
377 wxPanGestureEvent evt;
378 NSPoint tr = [gesture translationInView: self];
379 evt.SetDelta({(int) tr.x, (int) tr.y});
380 [self postEvent:evt withGesture:gesture];
381}

References wxNSCustomOpenGLView::postEvent:withGesture:.

Here is the call graph for this function:

◆ onGestureRotate:

- (void) onGestureRotate: (NSRotationGestureRecognizer*) gesture
implementation

Extends class wxNSCustomOpenGLView.

390 : (NSRotationGestureRecognizer*) gesture
391{
392 wxRotateGestureEvent evt;
393 evt.SetRotationAngle(-gesture.rotation);
394 [self postEvent:evt withGesture:gesture];
395}

References wxNSCustomOpenGLView::postEvent:withGesture:.

Here is the call graph for this function:

◆ onGestureScale:

- (void) onGestureScale: (NSMagnificationGestureRecognizer*) gesture
implementation

Extends class wxNSCustomOpenGLView.

383 : (NSMagnificationGestureRecognizer*) gesture
384{
385 wxZoomGestureEvent evt;
386 evt.SetZoomFactor(gesture.magnification + 1.0);
387 [self postEvent:evt withGesture:gesture];
388}

References wxNSCustomOpenGLView::postEvent:withGesture:.

Here is the call graph for this function:

◆ postEvent:withGesture:

- (void) postEvent: (wxGestureEvent &) evt
withGesture: (NSGestureRecognizer*) gesture 
implementation

Extends class wxNSCustomOpenGLView.

397 : (wxGestureEvent &) evt withGesture: (NSGestureRecognizer* ) gesture
398{
399 NSPoint pos = [gesture locationInView: self];
400 evt.SetPosition(wxFromNSPoint(self, pos));
401 if (gesture.state == NSGestureRecognizerStateBegan)
402 evt.SetGestureStart();
403 else if (gesture.state == NSGestureRecognizerStateEnded)
404 evt.SetGestureEnd();
405 if (wxEvtHandler* handler = get_gesture_handler(self))
406 handler->ProcessEvent(evt);
407}
static wxEvtHandler * get_gesture_handler(NSView *view)
Definition MacDarkMode.mm:358
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16

References get_gesture_handler().

Here is the call graph for this function:

◆ scrollWheel2:

- (void) scrollWheel2: (NSEvent *) event
implementation

Extends class wxNSCustomOpenGLView.

409 :(NSEvent *)event
410{
411 bool shiftDown = [event modifierFlags] & NSShiftKeyMask;
412 wxEvtHandler* handler = get_gesture_handler(self);
413 if (handler && shiftDown && event.hasPreciseScrollingDeltas) {
414 wxPanGestureEvent evt;
415 // NSOpenGLView uses bottom-left coordinates; wx gestures use top-left coordinates.
416 const wxPoint pos = wxFromNSPoint(self, [self convertPoint:[event locationInWindow] fromView:nil]);
417 const wxPoint delta(-(int)[event scrollingDeltaX], -(int)[event scrollingDeltaY]);
418 // Orca: GLCanvas3D derives the anchor position as position - delta, so synthesize
419 // the post-delta position from the native cursor coordinate.
420 evt.SetPosition(pos + delta);
421 evt.SetDelta(delta);
422 // Orca: Preserve the anchor throughout a trackpad scroll, including its momentum events.
423 // Keep it after phase Ended: momentum may follow. The next Began replaces it.
424 const NSEventPhase phase = event.phase;
425 const NSEventPhase momentum_phase = event.momentumPhase;
426 const bool unphased = phase == NSEventPhaseNone && momentum_phase == NSEventPhaseNone;
427 if (!is_scroll_pan_active(self) || unphased || (phase & (NSEventPhaseMayBegin | NSEventPhaseBegan)))
428 evt.SetGestureStart();
429 if (unphased || (phase & NSEventPhaseCancelled) ||
430 (momentum_phase & (NSEventPhaseEnded | NSEventPhaseCancelled)))
431 evt.SetGestureEnd();
432 set_scroll_pan_active(self, !evt.IsGestureEnd());
433 handler->ProcessEvent(evt);
434 } else {
435 // Orca: Switching away from Shift-pan must not reuse its depth when Shift is pressed again.
436 set_scroll_pan_active(self, false);
437 [self scrollWheel2: event];
438 }
439}
static bool is_scroll_pan_active(NSView *view)
Definition MacDarkMode.mm:363

References get_gesture_handler(), is_scroll_pan_active(), wxNSCustomOpenGLView::scrollWheel2:, and set_scroll_pan_active().

Here is the call graph for this function:

The documentation for this category was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/MacDarkMode.mm