Skip to content

Commit 7ad1308

Browse files
yadomicasesandberg
authored andcommitted
Get width and height from getBoundingClientRect (#391)
Since getBoundingClientRect return real value in pixel even if a css transformation is applied
1 parent 7ee60d8 commit 7ad1308

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/helpers/saturation.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export function calculateChange(e, skip, props, container) {
22
e.preventDefault()
3-
const containerWidth = container.clientWidth
4-
const containerHeight = container.clientHeight
3+
const { width: containerWidth, height: containerHeight } = container.getBoundingClientRect()
54
const x = typeof e.pageX === 'number' ? e.pageX : e.touches[0].pageX
65
const y = typeof e.pageY === 'number' ? e.pageY : e.touches[0].pageY
76
let left = x - (container.getBoundingClientRect().left + window.pageXOffset)

0 commit comments

Comments
 (0)