|
@@ -183,7 +183,7 @@ class SKPresentationOptionsSheetController: KMBaseWindowController {
|
|
self.effectPopUpButton.target = self
|
|
self.effectPopUpButton.target = self
|
|
self.effectPopUpButton.action = #selector(effectButtonAction)
|
|
self.effectPopUpButton.action = #selector(effectButtonAction)
|
|
|
|
|
|
- self.durationTF.formatter = NumberFormatter()
|
|
|
|
|
|
+// self.durationTF.formatter = NumberFormatter()
|
|
self.durationTF.delegate = self
|
|
self.durationTF.delegate = self
|
|
|
|
|
|
self.screeBtn.target = self
|
|
self.screeBtn.target = self
|
|
@@ -577,11 +577,35 @@ class SKPresentationOptionsSheetController: KMBaseWindowController {
|
|
extension SKPresentationOptionsSheetController: NSTextFieldDelegate {
|
|
extension SKPresentationOptionsSheetController: NSTextFieldDelegate {
|
|
func controlTextDidChange(_ obj: Notification) {
|
|
func controlTextDidChange(_ obj: Notification) {
|
|
if self.durationTF.isEqual(to: obj.object) {
|
|
if self.durationTF.isEqual(to: obj.object) {
|
|
- self.durationSlider.floatValue = self.durationTF.floatValue
|
|
|
|
|
|
+// self.durationSlider.floatValue = self.durationTF.floatValue
|
|
// 更新数据
|
|
// 更新数据
|
|
- self._updateInfo(key: KMDurationName, value: self.durationTF.floatValue)
|
|
|
|
|
|
+// self._updateInfo(key: KMDurationName, value: self.durationTF.floatValue)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ func controlTextDidEndEditing(_ obj: Notification) {
|
|
|
|
+ if self.durationTF.isEqual(to: obj.object) {
|
|
|
|
+ if checkString(str: self.durationTF.stringValue) {
|
|
|
|
+ self.durationSlider.floatValue = self.durationTF.floatValue
|
|
|
|
+ // 更新数据
|
|
|
|
+ self._updateInfo(key: KMDurationName, value: self.durationTF.floatValue)
|
|
|
|
+ }else{
|
|
|
|
+ self.durationTF.stringValue = "1.0"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+// func controlTextDidBeginEditing(_ obj: Notification) {
|
|
|
|
+// if self.durationTF.isEqual(to: obj.object) {
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+ func checkString(str: String) -> Bool {
|
|
|
|
+ let reg = "^[1-9]d*.d*|0.d*[1-9]d*|0?.0+|0$"
|
|
|
|
+ let pre = NSPredicate(format: "SELF MATCHES %@", reg)
|
|
|
|
+ if pre.evaluate(with: str) {
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// MARK: - NSWindowDelegate
|
|
// MARK: - NSWindowDelegate
|