Move the reset
-calls to occur last in the toolbar-constructors
By invoking the `reset` methods *last* in the `Toolbar`/`SecondaryToolbar`-constructors, we ensure that the "toolbarreset"/"secondarytoolbarreset"-events are actually handle when the viewer loads. Note that previously those events were dispatched *before* the relevant event-listeners had been attached. With this small change we can avoid inconsistent initial toolbar-state, specifically in the case when the viewer is *reloaded* (since Firefox keeps the HTML-state on "soft" reloads).
This commit is contained in:
parent
2b0b8cd665
commit
047522a34a
@ -152,14 +152,14 @@ class SecondaryToolbar {
|
||||
this.eventBus = eventBus;
|
||||
this.opened = false;
|
||||
|
||||
this.reset();
|
||||
|
||||
// Bind the event listeners for click, cursor tool, and scroll/spread mode
|
||||
// actions.
|
||||
this.#bindClickListeners();
|
||||
this.#bindCursorToolsListener(options);
|
||||
this.#bindScrollModeListener(options);
|
||||
this.#bindSpreadModeListener(options);
|
||||
|
||||
this.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,10 +111,10 @@ class Toolbar {
|
||||
editorInkParamsToolbar: options.editorInkParamsToolbar,
|
||||
};
|
||||
|
||||
this.reset();
|
||||
|
||||
// Bind the event listeners for click and various other actions.
|
||||
this.#bindListeners(options);
|
||||
|
||||
this.reset();
|
||||
}
|
||||
|
||||
setPageNumber(pageNumber, pageLabel) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user