Sanity-check decaffeinate app.views.Resizer

pull/1441/head
Simon Legner 1 year ago
parent 46d8d85ee2
commit 415a68b793

@ -1,26 +1,13 @@
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS206: Consider reworking classes to avoid initClass
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
(function () {
let MIN = undefined;
let MAX = undefined;
app.views.Resizer = class Resizer extends app.View { app.views.Resizer = class Resizer extends app.View {
static initClass() { static className = "_resizer";
this.className = "_resizer";
this.events = { static events = {
dragstart: "onDragStart", dragstart: "onDragStart",
dragend: "onDragEnd", dragend: "onDragEnd",
}; };
MIN = 260; static MIN = 260;
MAX = 600; static MAX = 600;
}
static isSupported() { static isSupported() {
return "ondragstart" in document.createElement("div") && !app.isMobile(); return "ondragstart" in document.createElement("div") && !app.isMobile();
@ -36,7 +23,7 @@
if (!(value > 0)) { if (!(value > 0)) {
return; return;
} }
value = Math.min(Math.max(Math.round(value), MIN), MAX); value = Math.min(Math.max(Math.round(value), Resizer.MIN), Resizer.MAX);
const newSize = `${value}px`; const newSize = `${value}px`;
document.documentElement.style.setProperty("--sidebarWidth", newSize); document.documentElement.style.setProperty("--sidebarWidth", newSize);
if (save) { if (save) {
@ -47,6 +34,7 @@
onDragStart(event) { onDragStart(event) {
event.dataTransfer.effectAllowed = "link"; event.dataTransfer.effectAllowed = "link";
event.dataTransfer.setData("Text", ""); event.dataTransfer.setData("Text", "");
this.onDrag = this.onDrag.bind(this);
$.on(window, "dragover", this.onDrag); $.on(window, "dragover", this.onDrag);
} }
@ -76,6 +64,3 @@
this.resize(value, true); this.resize(value, true);
} }
}; };
app.views.Resizer.initClass();
return app.views.Resizer;
})();

Loading…
Cancel
Save