Skip to content

Commit

Permalink
Taking into account menuitem controls and draganddrop control
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyblasta committed Dec 6, 2022
1 parent 11abf12 commit aa4d133
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ const Viewer = function Viewer(targetOption, options = {}) {

const addControl = function addControl(control) {
if (control.onAdd && control.dispatch) {
this.addComponent(control);
if (control.options.hideWhenEmbedded && isEmbedded(this.getTarget())) {
if (!['sharemap', 'link', 'about', 'print', 'draganddrop'].includes(control.name)) {
this.addComponent(control);
}
if(typeof control.hide === 'function') {
control.hide();
} else {
Expand All @@ -112,6 +114,8 @@ const Viewer = function Viewer(targetOption, options = {}) {
}
});
}
} else {
this.addComponent(control);
}
} else {
throw new Error('Valid control must have onAdd and dispatch methods');
Expand Down

0 comments on commit aa4d133

Please sign in to comment.