Skip to content

Commit

Permalink
fix: in some edge cases, cannot read property 'clientWidth' of undefined
Browse files Browse the repository at this point in the history
fixes #220
  • Loading branch information
linx4200 committed Dec 24, 2020
1 parent 1c3df13 commit 859cd7d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/common/Alpha.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export default {
handleChange (e, skip) {
!skip && e.preventDefault()
var container = this.$refs.container
if (!container) {
// for some edge cases, container may not exist. see #220
return;
}
var containerWidth = container.clientWidth
var xOffset = container.getBoundingClientRect().left + window.pageXOffset
Expand Down
4 changes: 4 additions & 0 deletions src/components/common/Hue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export default {
!skip && e.preventDefault()
var container = this.$refs.container
if (!container) {
// for some edge cases, container may not exist. see #220
return;
}
var containerWidth = container.clientWidth
var containerHeight = container.clientHeight
Expand Down
4 changes: 4 additions & 0 deletions src/components/common/Saturation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export default {
handleChange (e, skip) {
!skip && e.preventDefault()
var container = this.$refs.container
if (!container) {
// for some edge cases, container may not exist. see #220
return;
}
var containerWidth = container.clientWidth
var containerHeight = container.clientHeight
Expand Down

0 comments on commit 859cd7d

Please sign in to comment.