pressureChangeWithEvent
调用时机
示例代码
import Cocoa
class PressureSensitiveView: NSView {
override func pressureChangeWithEvent(_ event: NSEvent) {
// 处理压力变化事件
let pressure = event.pressure
let mouseLocation = event.locationInWindow
print("Pressure changed to: \(pressure) at \(mouseLocation)")
// 根据压力变化执行相应操作,例如调整绘图的粗细或透明度
}
}说明
注意事项
Last updated