I am trying to implement smartMagnify:
in an NSView
, but it is never called. I have rotate:
, magnify:
, etc., and they are all being called successfully - what do I need to do to receive this message? I've searched the documentation, which is extremely sparse, and can find no reason why it's not called.
Here's as much as I think is relevant of my code...
class FigOSXLayerView: FigOSXLayerViewBase /* NSView subclass */ {
var layerViewController: FigOSXLayerVC?
private var _scale: CGFloat = 1.0
override func draw(_ dirtyRect: NSRect) {
self.properties.showSelectionHighlight = true
self.properties.showAnnotation = true
self.properties.showPoints = true
super.draw(dirtyRect)
}
// ************************
// MARK: Zoom, pan, rotate
// ************************
override func magnify(with event: NSEvent) {
self._scale = 1 + event.magnification
self.layerViewController?.scale(self._scale)
}
override func rotate(with event: NSEvent) {
self.layerViewController?.rotate(CGFloat(event.rotation.toRadians))
}
override func scrollWheel(with event: NSEvent) {
self.layerViewController?.translate(dx: event.deltaX, dy: -event.deltaY)
}
override func smartMagnify(with event: NSEvent) {
Swift.print("Smart magnify") // Not called
}
// ...
}
Just through superstition, I have tried setting myself as First Responder, just in case it was something to do with that, but that makes no difference.