Skip to content

Commit

Permalink
fixed dom position
Browse files Browse the repository at this point in the history
  • Loading branch information
easylogic committed Mar 14, 2018
1 parent 8c0497a commit 1f0351d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
13 changes: 9 additions & 4 deletions addon/codemirror-colorpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1308,10 +1308,15 @@ var Dom = function () {
}, {
key: 'position',
value: function position() {
return {
top: parseFloat(this.el.style.top),
left: parseFloat(this.el.style.left)
};

if (this.el.style.top) {
return {
top: parseFloat(this.css('top')),
left: parseFloat(this.css('left'))
};
} else {
return this.el.getBoundingClientRect();
}
}
}, {
key: 'width',
Expand Down
17 changes: 9 additions & 8 deletions dist/codemirror-colorpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1310,10 +1310,15 @@ var Dom = function () {
}, {
key: 'position',
value: function position() {
return {
top: parseFloat(this.el.style.top),
left: parseFloat(this.el.style.left)
};

if (this.el.style.top) {
return {
top: parseFloat(this.css('top')),
left: parseFloat(this.css('left'))
};
} else {
return this.el.getBoundingClientRect();
}
}
}, {
key: 'width',
Expand Down Expand Up @@ -3898,8 +3903,6 @@ var ChromeColorControl = function (_EventMachin) {

var h = huePos.x / this.$hueContainer.width() * 360;

console.log(h);

return { h: h };
}
}, {
Expand Down Expand Up @@ -5165,8 +5168,6 @@ var ChromeDevtool = function (_EventMachin) {
colorObj = color.parse(c);
format = format || colorObj.type;

console.log(colorObj);

this.setCurrentFormat(format);

var hsv = this.getHSV(colorObj);
Expand Down
2 changes: 1 addition & 1 deletion dist/codemirror-colorpicker.min.js

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions src/util/Dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,16 @@ export default class Dom {
}

position () {
return {
top: parseFloat(this.el.style.top),
left: parseFloat(this.el.style.left)
};

if (this.el.style.top) {
return {
top: parseFloat(this.css('top')),
left: parseFloat(this.css('left'))
};
} else {
return this.el.getBoundingClientRect();
}

}

width () {
Expand Down

0 comments on commit 1f0351d

Please sign in to comment.