Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
139 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// GLLLogarithmicValueTransformer.swift | ||
// GLLara | ||
// | ||
// Created by Torsten Kammer on 16.09.12. | ||
// Copyright (c) 2012 Torsten Kammer. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
/** | ||
* @abstract Logarithmic Value Transformer | ||
* @discussion Used to allow setting of things like scales with a slider | ||
* that uses logarithmic scale. works in base 10. | ||
*/ | ||
@objc class GLLLogarithmicValueTransformer: ValueTransformer { | ||
@objc override class func allowsReverseTransformation() -> Bool { | ||
return true | ||
} | ||
@objc override class func transformedValueClass() -> AnyClass { | ||
return NSNumber.self | ||
} | ||
|
||
override func transformedValue(_ value: Any?) -> Any? { | ||
return log10((value as! NSNumber).doubleValue) | ||
} | ||
|
||
override func reverseTransformedValue(_ value: Any?) -> Any? { | ||
return pow(10.0, (value as! NSNumber).doubleValue) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.