feat(measurements): Provide for the Load (SR) measurements button to optionally clear existing measurements prior to loading the SR. (#4586)
This commit is contained in:
1 parent
7eec015ff1
commit
4d3d5e794c
15 files changed
+185
-128
No files matched your search
@@ -128,10 +128,11 @@ export default class ToolbarService extends PubSubService {
|
||||
/**
|
||||
* Adds buttons to the toolbar.
|
||||
* @param buttons - The buttons to be added.
|
||||
* @param replace - Flag indicating if any existing button with the same id as one being added should be replaced
|
||||
*/
|
||||
public addButtons(buttons: Button[]): void {
|
||||
public addButtons(buttons: Button[], replace: boolean = false): void {
|
||||
buttons.forEach(button => {
|
||||
if (!this.state.buttons[button.id]) {
|
||||
if (replace || !this.state.buttons[button.id]) {
|
||||
if (!button.props) {
|
||||
button.props = {};
|
||||
}
|
||||
@@ -383,12 +384,18 @@ export default class ToolbarService extends PubSubService {
|
||||
|
||||
/**
|
||||
* Creates a button section with the specified key and buttons.
|
||||
* Buttons already in the section (i.e. with the same ids) will NOT be added twice.
|
||||
* @param {string} key - The key of the button section.
|
||||
* @param {Array} buttons - The buttons to be added to the section.
|
||||
*/
|
||||
createButtonSection(key, buttons) {
|
||||
if (this.state.buttonSections[key]) {
|
||||
this.state.buttonSections[key].push(...buttons);
|
||||
this.state.buttonSections[key].push(
|
||||
buttons.filter(
|
||||
button =>
|
||||
!this.state.buttonSections[key].find(sectionButton => sectionButton.id === button.id)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
this.state.buttonSections[key] = buttons;
|
||||
}
|
||||
@@ -452,7 +459,7 @@ export default class ToolbarService extends PubSubService {
|
||||
|
||||
const buttonType = buttonTypes[uiType];
|
||||
|
||||
if (!buttonType) {
|
||||
if (!buttonType && !component) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user