Skip to content
Permalink
Browse files

Add assertions to ensure NSSize aspect always meaningful

  • Loading branch information...
alejx committed Jun 2, 2019
1 parent 0b0fcfc commit 9183a9fc450b2cebd6b492c46747237677d926ef
Showing with 2 additions and 0 deletions.
  1. +2 −0 iina/Extensions.swift
@@ -13,6 +13,7 @@ extension NSSlider {
func knobPointPosition() -> CGFloat {
let sliderOrigin = frame.origin.x + knobThickness / 2
let sliderWidth = frame.width - knobThickness
assert(maxValue > minValue)
let knobPos = sliderOrigin + sliderWidth * CGFloat((doubleValue - minValue) / (maxValue - minValue))
return knobPos
}
@@ -37,6 +38,7 @@ extension NSSize {

var aspect: CGFloat {
get {
assert(width != 0 && height != 0)
return width / height
}
}

0 comments on commit 9183a9f

Please sign in to comment.
You can’t perform that action at this time.