Add resize event and disable pointer events on iframes on trigger of resize (#4016)

This commit is contained in:
Khalid Adil 2021-07-14 19:32:45 -05:00 committed by GitHub
parent b3ceccd7fb
commit 10da314a4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 1 deletions

View File

@ -46,6 +46,7 @@
<multipane <multipane
class="l-shell__main" class="l-shell__main"
:class="[resizingClass]"
type="horizontal" type="horizontal"
> >
<pane <pane
@ -53,6 +54,8 @@
handle="after" handle="after"
label="Browse" label="Browse"
collapsable collapsable
@start-resizing="onStartResizing"
@end-resizing="onEndResizing"
> >
<button <button
slot="controls" slot="controls"
@ -102,6 +105,8 @@
handle="before" handle="before"
label="Inspect" label="Inspect"
collapsable collapsable
@start-resizing="onStartResizing"
@end-resizing="onEndResizing"
> >
<Inspector <Inspector
ref="inspector" ref="inspector"
@ -157,12 +162,16 @@ export default {
actionCollection: undefined, actionCollection: undefined,
triggerSync: false, triggerSync: false,
triggerReset: false, triggerReset: false,
headExpanded headExpanded,
isResizing: false
}; };
}, },
computed: { computed: {
toolbar() { toolbar() {
return this.hasToolbar && this.isEditing; return this.hasToolbar && this.isEditing;
},
resizingClass() {
return this.isResizing ? 'l-shell__resizing' : '';
} }
}, },
mounted() { mounted() {
@ -240,6 +249,12 @@ export default {
}, },
handleTreeReset() { handleTreeReset() {
this.triggerReset = !this.triggerReset; this.triggerReset = !this.triggerReset;
},
onStartResizing() {
this.isResizing = true;
},
onEndResizing() {
this.isResizing = false;
} }
} }
}; };

View File

@ -293,6 +293,12 @@
justify-content: space-between; justify-content: space-between;
padding: $p; padding: $p;
} }
&__resizing {
iframe {
pointer-events: none;
}
}
} }
.is-editing { .is-editing {

View File

@ -126,12 +126,14 @@ export default {
document.body.addEventListener('mousemove', this.updatePosition); document.body.addEventListener('mousemove', this.updatePosition);
document.body.addEventListener('mouseup', this.end); document.body.addEventListener('mouseup', this.end);
this.resizing = true; this.resizing = true;
this.$emit('start-resizing');
this.trackSize(); this.trackSize();
}, },
end: function (event) { end: function (event) {
document.body.removeEventListener('mousemove', this.updatePosition); document.body.removeEventListener('mousemove', this.updatePosition);
document.body.removeEventListener('mouseup', this.end); document.body.removeEventListener('mouseup', this.end);
this.resizing = false; this.resizing = false;
this.$emit('end-resizing');
this.trackSize(); this.trackSize();
} }
} }