diff --git a/modules/juce_graphics/geometry/juce_Point.h b/modules/juce_graphics/geometry/juce_Point.h index abc5dc4a7a..dc89cf767a 100644 --- a/modules/juce_graphics/geometry/juce_Point.h +++ b/modules/juce_graphics/geometry/juce_Point.h @@ -120,12 +120,22 @@ public: Point& operator/= (Point other) noexcept { *this = *this / other; return *this; } /** Returns a point whose coordinates are multiplied by a given scalar value. */ - template - constexpr Point operator* (FloatType multiplier) const noexcept { return Point ((ValueType) ((FloatType) x * multiplier), (ValueType) ((FloatType) y * multiplier)); } + template + constexpr Point operator* (OtherType multiplier) const noexcept + { + using CommonType = typename std::common_type::type; + return Point ((ValueType) ((CommonType) x * (CommonType) multiplier), + (ValueType) ((CommonType) y * (CommonType) multiplier)); + } /** Returns a point whose coordinates are divided by a given scalar value. */ - template - constexpr Point operator/ (FloatType divisor) const noexcept { return Point ((ValueType) ((FloatType) x / divisor), (ValueType) ((FloatType) y / divisor)); } + template + constexpr Point operator/ (OtherType divisor) const noexcept + { + using CommonType = typename std::common_type::type; + return Point ((ValueType) ((CommonType) x / (CommonType) divisor), + (ValueType) ((CommonType) y / (CommonType) divisor)); + } /** Multiplies the point's coordinates by a scalar value. */ template