While this plugin is useful, when it is used to resize the sidebar to less than 200px, and interaction using the mouse on the divider to adjust width forces it back to either 200px or 0px.
in app.js
, this is responsible for resizing
t.prototype.setSize = function(e) {
this.size = e,
this.containerEl.style.width = "".concat(e, "px")
}
setSize
is found in onSidedockResizeStart
, responsible for adjusting sidebar width with mouse:
t.prototype.onSidedockResizeStart = function(e) {
var t = this;
if (0 === e.button) {
var n = e.win;
this.app.disableCssTransition();
var i = function(e) {
var n = e.clientX
, i = dF
, r = t.containerEl.getBoundingClientRect();
if ("left" === t.side ? (i = n - r.x,
i += t.resizeHandleEl.offsetWidth / 2) : "right" === t.side && (i = t.workspace.containerEl.clientWidth - n,
i += t.resizeHandleEl.offsetWidth / 2),
!t.collapsed && i < 50)
t.collapse();
else if (t.collapsed && i >= dF)
t.expand();
else if (!t.collapsed) {
var o = t.workspace.containerEl.clientWidth
, a = Math.clamp(i, dF, Math.max(dF, .8 * o));
t.setSize(a)
}
e.preventDefault()
}
, r = function(e) {
0 === e.button && (n.removeEventListener("mousemove", i),
n.removeEventListener("mouseup", r),
document.body.removeClass("is-grabbing"),
t.app.enableCssTransition(),
t.workspace.requestSaveLayout(),
t.workspace.requestResize())
};
n.addEventListener("mousemove", i),
n.addEventListener("mouseup", r),
document.body.addClass("is-grabbing")
}
}
specifically this section in the middle:
else if (!t.collapsed) {
var o = t.workspace.containerEl.clientWidth
, a = Math.clamp(i, dF, Math.max(dF, .8 * o));
t.setSize(a)
}
Leads me to believe:
i
is the width chosen by the user using the mouse,
dF
is the min-width
.8*o
is 80% of the clientWidth
also this part sets position (50px from edge) that the window collapses to 0px at:
if ("left" === t.side ? (i = n - r.x,
i += t.resizeHandleEl.offsetWidth / 2) : "right" === t.side && (i = t.workspace.containerEl.clientWidth - n,
i += t.resizeHandleEl.offsetWidth / 2),
!t.collapsed && i < 50)
t.collapse();
Is it possible a plugin can be written that places new variables in place of the dF
and the 50
above?