Skip to content

Commit dfdabc8

Browse files
committed
feat(QColorPicker): RTL support
1 parent e136ac3 commit dfdabc8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/components/color/QColorPicker.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default {
9595
saturationPointerStyle () {
9696
return {
9797
top: `${101 - this.model.v}%`,
98-
left: `${this.model.s}%`
98+
[this.$q.i18n.rtl ? 'right' : 'left']: `${this.model.s}%`
9999
}
100100
},
101101
inputsArray () {
@@ -285,8 +285,14 @@ export default {
285285
panel = this.$refs.saturation,
286286
width = panel.clientWidth,
287287
height = panel.clientHeight,
288-
rect = panel.getBoundingClientRect(),
289-
x = Math.min(width, Math.max(0, left - rect.left)),
288+
rect = panel.getBoundingClientRect()
289+
let x = Math.min(width, Math.max(0, left - rect.left))
290+
291+
if (this.$q.i18n.rtl) {
292+
x = width - x
293+
}
294+
295+
const
290296
y = Math.min(height, Math.max(0, top - rect.top)),
291297
s = Math.round(100 * x / width),
292298
v = Math.round(100 * Math.max(0, Math.min(1, -(y / height) + 1))),

0 commit comments

Comments
 (0)