Common code for splitter install.
This commit is contained in:
parent
40cdc0a93d
commit
7bb6363559
@ -119,23 +119,8 @@ OV.Navigator = class
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let originalWidth = null;
|
OV.InstallVerticalSplitter (this.splitterDiv, this.mainDiv, false, () => {
|
||||||
OV.CreateVerticalSplitter (this.splitterDiv, {
|
this.callbacks.onResize ();
|
||||||
onSplitStart : () => {
|
|
||||||
originalWidth = this.mainDiv.outerWidth (true);
|
|
||||||
},
|
|
||||||
onSplit : (xDiff) => {
|
|
||||||
const minWidth = 280;
|
|
||||||
const maxWidth = 450;
|
|
||||||
let newWidth = originalWidth + xDiff;
|
|
||||||
if (newWidth < minWidth) {
|
|
||||||
newWidth = minWidth;
|
|
||||||
} else if (newWidth > maxWidth) {
|
|
||||||
newWidth = maxWidth;
|
|
||||||
}
|
|
||||||
this.mainDiv.outerWidth (newWidth, true);
|
|
||||||
this.callbacks.onResize ();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,23 +59,8 @@ OV.Sidebar = class
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
let originalWidth = null;
|
OV.InstallVerticalSplitter (this.splitterDiv, this.mainDiv, true, () => {
|
||||||
OV.CreateVerticalSplitter (this.splitterDiv, {
|
this.callbacks.onResize ();
|
||||||
onSplitStart : () => {
|
|
||||||
originalWidth = this.mainDiv.outerWidth (true);
|
|
||||||
},
|
|
||||||
onSplit : (xDiff) => {
|
|
||||||
const minWidth = 280;
|
|
||||||
const maxWidth = 450;
|
|
||||||
let newWidth = originalWidth - xDiff;
|
|
||||||
if (newWidth < minWidth) {
|
|
||||||
newWidth = minWidth;
|
|
||||||
} else if (newWidth > maxWidth) {
|
|
||||||
newWidth = maxWidth;
|
|
||||||
}
|
|
||||||
this.mainDiv.outerWidth (newWidth, true);
|
|
||||||
this.callbacks.onResize ();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -154,3 +154,30 @@ OV.CreateInlineColorCircle = function (color)
|
|||||||
let darkerColorHexString = '#' + OV.ColorToHexString (darkerColor);
|
let darkerColorHexString = '#' + OV.ColorToHexString (darkerColor);
|
||||||
return $('<div>').addClass ('ov_color_circle').css ('background', hexString).css ('border', '1px solid ' + darkerColorHexString);
|
return $('<div>').addClass ('ov_color_circle').css ('background', hexString).css ('border', '1px solid ' + darkerColorHexString);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
OV.InstallVerticalSplitter = function (splitterDiv, resizedDiv, flipped, onResize)
|
||||||
|
{
|
||||||
|
let originalWidth = null;
|
||||||
|
OV.CreateVerticalSplitter (splitterDiv, {
|
||||||
|
onSplitStart : () => {
|
||||||
|
originalWidth = resizedDiv.outerWidth (true);
|
||||||
|
},
|
||||||
|
onSplit : (xDiff) => {
|
||||||
|
const minWidth = 280;
|
||||||
|
const maxWidth = 450;
|
||||||
|
let newWidth = 0;
|
||||||
|
if (flipped) {
|
||||||
|
newWidth = originalWidth - xDiff;
|
||||||
|
} else {
|
||||||
|
newWidth = originalWidth + xDiff;
|
||||||
|
}
|
||||||
|
if (newWidth < minWidth) {
|
||||||
|
newWidth = minWidth;
|
||||||
|
} else if (newWidth > maxWidth) {
|
||||||
|
newWidth = maxWidth;
|
||||||
|
}
|
||||||
|
resizedDiv.outerWidth (newWidth, true);
|
||||||
|
onResize ();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user