我正在尝试在rotate:
中实现smartMagnify:
,但它永远不会被调用。我有magnify:
,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
}
// ...
}
等等,并且它们都被成功调用 - 我需要做什么才能收到此消息?我搜索过的文档非常稀疏,没有理由不调用它。
我认为这与我的代码相关......
[(1, 'Twilight Sparkle', 2, 'Fluttershy'), (1, 'Twilight Sparkle', 3,
'Applejack'), (1, 'Twilight Sparkle', 4, 'Pinkie Pie'), (1, 'Twilight
Sparkle', 5, 'Rarity'), (1, 'Twilight Sparkle', 6, 'Rainbow Dash'),
(1, 'Twilight Sparkle', 7, 'Princess Celestia'), (1, 'Twilight
Sparkle', 8, 'Princess Luna'), (2, 'Fluttershy', 3, 'Applejack'), (2,
'Fluttershy', 4, 'Pinkie Pie'), (2, 'Fluttershy', 5, 'Rarity'), (2,
'Fluttershy', 6, 'Rainbow Dash'), (2, 'Fluttershy', 7, 'Princess
Celestia'), (2, 'Fluttershy', 8, 'Princess Luna'), (3, 'Applejack', 4,
'Pinkie Pie'), (3, 'Applejack', 5, 'Rarity'), (3, 'Applejack', 6,
'Rainbow Dash'), (3, 'Applejack', 7, 'Princess Celestia'), (3,
'Applejack', 8, 'Princess Luna'), (4, 'Pinkie Pie', 5, 'Rarity'), (4,
'Pinkie Pie', 6, 'Rainbow Dash'), (4, 'Pinkie Pie', 7, 'Princess
Celestia'), (4, 'Pinkie Pie', 8, 'Princess Luna'), (5, 'Rarity', 6,
'Rainbow Dash'), (5, 'Rarity', 7, 'Princess Celestia'), (5, 'Rarity',
8, 'Princess Luna'), (6, 'Rainbow Dash', 7, 'Princess Celestia'), (6,
'Rainbow Dash', 8, 'Princess Luna'), (7, 'Princess Celestia', 8,
'Princess Luna')]
只是通过迷信,我已经尝试将自己设置为第一响应者,以防它与此有关,但这没有任何区别。
答案 0 :(得分:0)
当您用两根手指双击时,此事件会触发。