Skip to content

Commit

Permalink
Merge branch 'gh-pages' of https://github.com/LivelyKernel/lively4-core
Browse files Browse the repository at this point in the history
… into gh-pages
  • Loading branch information
onsetsu committed Dec 20, 2023
2 parents 254071a + cfa6f3b commit f0d6a0a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion demos/tree-sitter/codemirror.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- [X] hide line numbers
- [X] hide scrollbars
- [ ] update RegExp match while editing

- [ ] Stefan's hide indentation/whitespace issue in shards

## Probe Example

Expand Down
16 changes: 12 additions & 4 deletions src/client/morphic/selecting.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ export default class Selecting {
// return
// }

// console.log("mouse down " + e.target.tagName)
e.stopPropagation();
e.preventDefault();
// console.log("[selecting.js] mouse down " + e.target.tagName)
// e.stopPropagation();
// e.preventDefault();
}
}

static handleMouseUp(e) {

if (this.shouldHandle(e)) {
console.log("mouse up " + e.target.tagName)
// console.log("[selecting.js] mouse up " + e.target.tagName)
e.stopPropagation();
e.preventDefault();
} else {
Expand Down Expand Up @@ -102,6 +103,13 @@ export default class Selecting {
static handleSelect(e) {
// lively.notify("path " + e.composedPath().map(ea => ea.tagName))

// we are custom dragging... and not selecting
if (lively.lastDragTime && ((Date.now() - lively.lastDragTime) < 1000)) {
// lively.showEvent(e).innerHTML = "custom drag"
return
}


if (this.shouldHandle(e)) {
// lively.showElement(e.composedPath()[0],1300).textContent = "path: " + e.composedPath().map(ea => ea.tagName).join(",")
var path = this.slicePathIfContainerContent(e.composedPath());
Expand Down
1 change: 1 addition & 0 deletions src/client/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default class Preferences {
BabylonianProgramming: {default: false, short: "use babylonian programming editor"},
SandblocksText: {default: false, short: "use sandblocks text editor"},
TabbedWindows: {default: false, short: "use experimental window tabs"},
AltDragWindows: {default: false, short: "alt drag windows"},
SWEDebugging: {default: false, short: "bug showcase in swe lecture"},
AEXPGraphExperimental: {default: false, short: "AExpr graph experimental"},
GSFullLogInfo: {default: false, short: "full log info for GS"},
Expand Down
2 changes: 1 addition & 1 deletion src/components/widgets/lively-code-mirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export default class LivelyCodeMirror extends HTMLElement {
// editor.setOption("showTrailingSpace", true)
// editor.setOption("matchTags", true)

);editor.on("change", evt => this.dispatchEvent(new CustomEvent("change", { detail: evt })));
);editor.on("change", (doc, evt) => this.dispatchEvent(new CustomEvent("change", { detail: evt })));
editor.on("change", (() => this.checkSyntax()).debounce(500));
editor.on("change", (() => this.astCapabilities.codeChanged()).debounce(200));

Expand Down
15 changes: 15 additions & 0 deletions src/components/widgets/lively-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ export default class Window extends Morph {
this.get('.window-min').addEventListener('click', evt => { this.onMinButtonClicked(evt); });
this.get('.window-unmin').addEventListener('click', evt => { this.onMinButtonClicked(evt); });

this.addEventListener('pointerdown', evt => { this.onPointerDown(evt) }, {capture: true});

this.maxButton.addEventListener('click', evt => { this.onMaxButtonClicked(evt); });
this.addEventListener('dblclick', evt => { this.onDoubleClick(evt); });
this.get('.window-close').addEventListener('click', evt => { this.onCloseButtonClicked(evt); });
Expand Down Expand Up @@ -451,6 +453,7 @@ export default class Window extends Morph {
}
this.dragging = pt(evt.clientX, evt.clientY)
}

lively.removeEventListener('lively-window-drag', this.windowTitle)

lively.addEventListener('lively-window-drag', document.documentElement, 'pointermove',
Expand Down Expand Up @@ -506,6 +509,8 @@ export default class Window extends Morph {
.subPt(this.dragging).subPt(lively.getScroll())
lively.setPosition(this, Grid.optSnapPosition(pos, evt))
}

lively.lastDragTime = Date.now()
}
}

Expand All @@ -528,6 +533,16 @@ export default class Window extends Morph {
}
this.dropintoOtherWindow = null;
}


onPointerDown(evt) {
if (lively.preferences.get("AltDragWindows") && evt.altKey) { //

// lively.showEvent(evt).innerHTML = "alt: " + evt.altKey
this.onTitleMouseDown(evt)
}

}

onExtentChanged(evt) {
// console.log(evt); // evt has no content? => current bounds must already have been refreshed
Expand Down

0 comments on commit f0d6a0a

Please sign in to comment.