mirror of
https://github.com/trudnai/Steve2.git
synced 2025-01-28 06:35:38 +00:00
Disable Scrolling in NSScrollView
This commit is contained in:
parent
7f7078b45e
commit
6d0582e935
58
A2Mac/DisplayScrollView.swift
Normal file
58
A2Mac/DisplayScrollView.swift
Normal file
@ -0,0 +1,58 @@
|
||||
//
|
||||
// DisplayScrollView.swift
|
||||
// A2Mac
|
||||
//
|
||||
// Created by Tamas Rudnai on 11/10/21.
|
||||
// Copyright © 2021 GameAlloy. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Cocoa
|
||||
|
||||
class DisplayScrollView : NSScrollView {
|
||||
|
||||
var scrollEnabled = false
|
||||
|
||||
override func scrollWheel(with event: NSEvent) {
|
||||
if scrollEnabled {
|
||||
super.scrollWheel(with: event)
|
||||
}
|
||||
}
|
||||
|
||||
override func scrollPageUp(_ sender: Any?) {
|
||||
if scrollEnabled {
|
||||
super.scrollPageUp(sender)
|
||||
}
|
||||
}
|
||||
override func scrollLineUp(_ sender: Any?) {
|
||||
if scrollEnabled {
|
||||
super.scrollLineUp(sender)
|
||||
}
|
||||
}
|
||||
override func scrollPageDown(_ sender: Any?) {
|
||||
if scrollEnabled {
|
||||
super.scrollPageDown(sender)
|
||||
}
|
||||
}
|
||||
override func scrollLineDown(_ sender: Any?) {
|
||||
if scrollEnabled {
|
||||
super.scrollLineDown(sender)
|
||||
}
|
||||
}
|
||||
override func scrollToBeginningOfDocument(_ sender: Any?) {
|
||||
if scrollEnabled {
|
||||
super.scrollToBeginningOfDocument(sender)
|
||||
}
|
||||
}
|
||||
override func scrollToEndOfDocument(_ sender: Any?) {
|
||||
if scrollEnabled {
|
||||
super.scrollToEndOfDocument(sender)
|
||||
}
|
||||
}
|
||||
override func scroll(_ point: NSPoint) {
|
||||
if scrollEnabled {
|
||||
super.scroll(point)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user