Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ensureCwdButton(cwd) {
var btn = this.getSubmorphNamed("changeCwdButton")
if (btn) return btn;
btn = morph({
type: "button", name: "changeCwdButton",
padding: Rectangle.inset(4,2),
label: cwd || "...", extent: pt(60,20), borderRadius: 3
});
connect(btn, 'fire', this, 'execCommand', {converter: () => "[shell] change working directory"});
return btn;
}
resizer() {
var win = this, resizer = this.getSubmorphNamed("resizer");
if (resizer) return resizer;
resizer = morph({
name: "resizer",
nativeCursor: "nwse-resize",
extent: pt(20, 20),
origin: pt(20,20),
fill: Color.transparent,
bottomRight: this.extent
});
connect(resizer, "onDragStart", resizer, "scale", {converter: evt => 10});
connect(resizer, "onDrag", win, "resizeBy", {converter: evt => evt.state.dragDelta});
connect(resizer, "onDragEnd", resizer, "scale", {converter: evt => 1});
return resizer;
}
resizer() {
var win = this, resizer = this.getSubmorphNamed("resizer");
if (resizer) return resizer;
resizer = morph({
name: "resizer",
nativeCursor: "nwse-resize",
extent: pt(20, 20),
origin: pt(20,20),
fill: Color.transparent,
bottomRight: this.extent
});
connect(resizer, "onDragStart", resizer, "scale", {converter: evt => 10});
connect(resizer, "onDrag", win, "resizeBy", {converter: evt => evt.state.dragDelta});
connect(resizer, "onDragEnd", resizer, "scale", {converter: evt => 1});
return resizer;
}
getOrAddButton(spec, connectTo) {
let btn = this.getSubmorphNamed(spec.name);
if (btn) return btn;
if (!spec.tooltip) spec.tooltip = spec.name;
btn = this.addMorph({...this.btnStyle, ...spec});
connectTo && connect(btn, "fire", this, connectTo);
return btn;
}
ensureCwdButton(cwd) {
var btn = this.getSubmorphNamed("changeCwdButton");
if (btn) return btn;
btn = morph({
type: "button", name: "changeCwdButton",
padding: Rectangle.inset(4,2),
label: cwd || "...", extent: pt(60,20), borderRadius: 3
});
connect(btn, "fire", this, "execCommand", {converter: () => "[shell] change working directory"});
return btn;
}