Skip to content

Commit

Permalink
Fix Hue Slider goes out of bounds on mobile
Browse files Browse the repository at this point in the history
Close #8243
  • Loading branch information
hrb-hub committed Jan 9, 2025
1 parent e86dad5 commit cfea2a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/gui/base/colorPicker/ColorPickerView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { hexToHSL, hslToHex, isColorLight, isValidCSSHexColor, MAX_HUE_ANGLE, no
import { ColorPickerModel } from "./ColorPickerModel.js"
import { client } from "../../../misc/ClientDetector.js"
import { theme } from "../../theme.js"
import { assertNotNull, filterInt } from "@tutao/tutanota-utils"
import { assertNotNull, clamp, filterInt } from "@tutao/tutanota-utils"
import { Keys, TabIndex } from "../../../api/common/TutanotaConstants"
import { isKeyPressed } from "../../../misc/KeyManager"

Expand Down Expand Up @@ -430,7 +430,7 @@ export class ColorPickerView implements Component<ColorPickerViewAttrs> {
private handleHueChange = (e: PointerEvent | TouchEvent, hueImgDom: HTMLElement) => {
const hueImgDomRect = hueImgDom.getBoundingClientRect()
const eClientX = "clientX" in e ? e.clientX : e.touches[0].clientX
const posX = Math.floor(eClientX - hueImgDomRect.left + HUE_GRADIENT_BORDER_WIDTH)
const posX = clamp(eClientX - hueImgDomRect.left + HUE_GRADIENT_BORDER_WIDTH, HUE_GRADIENT_BORDER_WIDTH, hueImgDomRect.width)
this.selectedHueAngle = Math.floor((posX / hueImgDomRect.width) * MAX_HUE_ANGLE)

if (this.hueSliderDom) {
Expand Down

0 comments on commit cfea2a4

Please sign in to comment.