Handle resizing over an iframe issue
This commit is contained in:
@@ -30,7 +30,7 @@ class PanelResizer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
controller($scope, $element, modelManager, actionsManager, $timeout) {
|
controller($scope, $element, modelManager, actionsManager, $timeout, $compile) {
|
||||||
'ngInject';
|
'ngInject';
|
||||||
|
|
||||||
let panel = document.getElementById($scope.panelId);
|
let panel = document.getElementById($scope.panelId);
|
||||||
@@ -45,7 +45,6 @@ class PanelResizer {
|
|||||||
var startWidth = panel.scrollWidth, startX = 0, lastDownX = 0, collapsed, lastWidth = startWidth, startLeft, lastLeft;
|
var startWidth = panel.scrollWidth, startX = 0, lastDownX = 0, collapsed, lastWidth = startWidth, startLeft, lastLeft;
|
||||||
var appFrame;
|
var appFrame;
|
||||||
|
|
||||||
|
|
||||||
// Handle Double Click Event
|
// Handle Double Click Event
|
||||||
var widthBeforeLastDblClick = 0;
|
var widthBeforeLastDblClick = 0;
|
||||||
resizerColumn.ondblclick = () => {
|
resizerColumn.ondblclick = () => {
|
||||||
@@ -151,7 +150,30 @@ class PanelResizer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
If an iframe is displayed adjacent to our panel, and your mouse exits over the iframe,
|
||||||
|
document[onmouseup] is not triggered because the document is no longer the same over the iframe.
|
||||||
|
We add an invisible overlay while resizing so that the mouse context remains in our main document.
|
||||||
|
*/
|
||||||
|
$scope.addInvisibleOverlay = function() {
|
||||||
|
if($scope.overlay) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.overlay = $compile("<div id='resizer-overlay'></div>")($scope);
|
||||||
|
angular.element(document.body).prepend($scope.overlay);
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.removeInvisibleOverlay = function() {
|
||||||
|
if($scope.overlay) {
|
||||||
|
$scope.overlay.remove();
|
||||||
|
$scope.overlay = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resizerColumn.addEventListener("mousedown", function(event){
|
resizerColumn.addEventListener("mousedown", function(event){
|
||||||
|
$scope.addInvisibleOverlay();
|
||||||
|
|
||||||
pressed = true;
|
pressed = true;
|
||||||
lastDownX = event.clientX;
|
lastDownX = event.clientX;
|
||||||
startWidth = panel.scrollWidth;
|
startWidth = panel.scrollWidth;
|
||||||
@@ -230,7 +252,9 @@ class PanelResizer {
|
|||||||
$scope.setWidth(newWidth, false);
|
$scope.setWidth(newWidth, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("mouseup", function(event){
|
document.addEventListener("mouseup", (event) => {
|
||||||
|
$scope.removeInvisibleOverlay();
|
||||||
|
|
||||||
if(pressed) {
|
if(pressed) {
|
||||||
pressed = false;
|
pressed = false;
|
||||||
resizerColumn.classList.remove("dragging");
|
resizerColumn.classList.remove("dragging");
|
||||||
@@ -246,7 +270,6 @@ class PanelResizer {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
angular.module('app').directive('panelResizer', () => new PanelResizer);
|
angular.module('app').directive('panelResizer', () => new PanelResizer);
|
||||||
|
|||||||
@@ -75,6 +75,15 @@ p {
|
|||||||
|
|
||||||
$footer-height: 32px;
|
$footer-height: 32px;
|
||||||
|
|
||||||
|
#resizer-overlay {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: transparent;
|
||||||
|
z-index: 1000;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.app {
|
.app {
|
||||||
height: calc(100% - #{$footer-height});
|
height: calc(100% - #{$footer-height});
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -86,7 +95,7 @@ $footer-height: 32px;
|
|||||||
panel-resizer {
|
panel-resizer {
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 1;
|
z-index: 1001;
|
||||||
width: 8px;
|
width: 8px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
Reference in New Issue
Block a user