Show picker on left side if it doesn't fit at the bottom
This commit is contained in:
parent
30d7a7b2a6
commit
61039c665e
|
@ -129,6 +129,8 @@ treemode.destroy = function () {
|
|||
* @private
|
||||
*/
|
||||
treemode._setOptions = function (options) {
|
||||
var editor = this;
|
||||
|
||||
this.options = {
|
||||
search: true,
|
||||
history: true,
|
||||
|
@ -142,10 +144,15 @@ treemode._setOptions = function (options) {
|
|||
colorPicker: true,
|
||||
onColorPicker: function (parent, color, onChange) {
|
||||
if (VanillaPicker) {
|
||||
var contentRect = editor.content.getBoundingClientRect();
|
||||
var parentRect = parent.getBoundingClientRect();
|
||||
var pickerWidth = 250;
|
||||
var pickerRight = parentRect.right + pickerWidth;
|
||||
|
||||
new VanillaPicker({
|
||||
parent: parent,
|
||||
color: color,
|
||||
popup: 'bottom',
|
||||
popup: (pickerRight < contentRect.right) ? 'bottom' : 'left',
|
||||
onDone: function (color) {
|
||||
var alpha = color.rgba[3]
|
||||
var hex = (alpha === 1)
|
||||
|
|
Loading…
Reference in New Issue