Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Editor] Add a z-index in order to draw them in the right order #15196

Merged
merged 1 commit into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions src/display/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ import { bindEvents, ColorManager } from "./tools.js";
class AnnotationEditor {
#isInEditMode = false;

#zIndex = AnnotationEditor._zIndex++;

static _colorManager = new ColorManager();

static _zIndex = 1;

/**
* @param {AnnotationEditorParameters} parameters
*/
Expand Down Expand Up @@ -74,14 +78,14 @@ class AnnotationEditor {
* This editor will be behind the others.
*/
setInBackground() {
this.div.classList.add("background");
this.div.style.zIndex = 0;
}

/**
* This editor will be in the foreground.
*/
setInForeground() {
this.div.classList.remove("background");
this.div.style.zIndex = this.#zIndex;
}

/**
Expand Down Expand Up @@ -222,6 +226,8 @@ class AnnotationEditor {
this.div.setAttribute("id", this.id);
this.div.tabIndex = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is where my previous comment applies.


this.setInForeground();

const [tx, ty] = this.getInitialTranslation();
this.translate(tx, ty);

Expand Down
4 changes: 0 additions & 4 deletions web/annotation_editor_layer_builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@
cursor: auto;
}

.annotationEditorLayer .background {
z-index: 0;
}

.annotationEditorLayer .inkEditor:focus {
outline: var(--focus-outline);
resize: both;
Expand Down