swift - NSView/NSResponder smartMagnify: -
i trying implement smartmagnify:
in nsview
, never called. have rotate:
, magnify:
, etc., , being called - need receive message? i've searched documentation, extremely sparse, , can find no reason why it's not called.
here's as think relevant of 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, have tried setting myself first responder, in case that, makes no difference.
Comments
Post a Comment