Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions timApp/static/scripts/tim/ui/draggable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,19 +234,31 @@ export class DraggableController implements IController {
} else {
this.element.css("position", this.anchor);
this.element.css("visibility", "visible");
if (this.slidePars) {
this.initSlidePars();
}
void this.restoreSizeAndPosition(VisibilityFix.Full);
this.element.removeClass("draggable-attached");
this.element.addClass("draggable-detached");
// console.log("detach", this.slidePars);
if (this.slidePars) {
vctrlInstance?.addSlideParsState();
}
}
this.element.css("z-index", this.getVisibleLayer());

this.detachStorage.set(!canDrag);
}

private initSlidePars() {
// Move the window to top-left corner unless it was moved previously.
if (!this.posStorage.get()) {
if (this.setLeft) {
this.element.css("left", 0);
}
if (this.setTop) {
this.element.css("top", 0);
}
}
vctrlInstance?.addSlideParsState();
}

/**
* The layering of pareditor's detachable windows acts weird (Source Block Preview's arrow and contents show above
* detached windows) so this makes use of z-indexes to work around it.
Expand Down Expand Up @@ -389,6 +401,10 @@ export class DraggableController implements IController {
if (!this.posKey) {
return;
}
// Don't try to restore size and position if the element is not draggable.
if (!this.canDrag()) {
return;
}
const oldSize = this.sizeStorage.get() ?? this.initialSize;
if (oldSize && this.canDrag() && !this.isMinimized()) {
const vps = getViewPortSize();
Expand Down