Move the resizeDetector and use document-container for the event handling.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com> Change-Id: I6990480da8ba3a058e4e5d32407bf38d341e8ee4
This commit is contained in:
parent
d04d6bd392
commit
e5392d861a
2 changed files with 1 additions and 31 deletions
|
@ -26,7 +26,6 @@ L.Map = L.Evented.extend({
|
|||
maxZoom: 18,
|
||||
maxBounds: L.latLngBounds([0, 0], [-100, 100]),
|
||||
fadeAnimation: false, // Not useful for typing.
|
||||
trackResize: true,
|
||||
markerZoomAnimation: true,
|
||||
// defaultZoom:
|
||||
// The zoom level at which the tile size in twips equals the default size (3840 x 3840).
|
||||
|
@ -74,9 +73,6 @@ L.Map = L.Evented.extend({
|
|||
this._initContainer(id);
|
||||
this._initLayout();
|
||||
|
||||
// hack for https://github.com/Leaflet/Leaflet/issues/1980
|
||||
this._onResize = L.bind(this._onResize, this);
|
||||
|
||||
// Start with readonly toolbars on desktop
|
||||
if (window.mode.isDesktop()) {
|
||||
L.DomUtil.addClass(L.DomUtil.get('toolbar-wrapper'), 'readonly');
|
||||
|
@ -195,8 +191,6 @@ L.Map = L.Evented.extend({
|
|||
this._fireInitComplete('doclayerinit');
|
||||
}
|
||||
|
||||
// We need core's knowledge of whether it is a mobile phone
|
||||
// or not to be in sync with the test in _onJSDialogMsg in TileLayer.js.
|
||||
if (window.mode.isMobile())
|
||||
{
|
||||
document.getElementById('document-container').classList.add('mobile');
|
||||
|
@ -1201,14 +1195,6 @@ L.Map = L.Evented.extend({
|
|||
throw new Error('Map container is already initialized.');
|
||||
}
|
||||
|
||||
if (window.mode.isDesktop()) {
|
||||
this._resizeDetector = L.DomUtil.create('iframe', 'resize-detector', container);
|
||||
this._resizeDetector.title = 'Intentionally blank';
|
||||
this._resizeDetector.setAttribute('aria-hidden', 'true');
|
||||
this._resizeDetector.contentWindow.addEventListener('touchstart', L.DomEvent.preventDefault, {passive: false});
|
||||
L.DomEvent.on(this._resizeDetector.contentWindow, 'contextmenu', L.DomEvent.preventDefault);
|
||||
}
|
||||
|
||||
this._fileDownloader = L.DomUtil.create('iframe', '', container);
|
||||
L.DomUtil.setStyle(this._fileDownloader, 'display', 'none');
|
||||
|
||||
|
@ -1339,11 +1325,7 @@ L.Map = L.Evented.extend({
|
|||
|
||||
this._mainEvents(onOff);
|
||||
|
||||
if (this.options.trackResize) {
|
||||
var winTarget = this._resizeDetector && this._resizeDetector.contentWindow ? this._resizeDetector.contentWindow :
|
||||
window;
|
||||
L.DomEvent[onOff](winTarget, 'resize', this._onResize, this);
|
||||
}
|
||||
document.getElementById('document-container').addEventListener('resize', this._onResize.bind(this));
|
||||
|
||||
L.DomEvent[onOff](window, 'blur', this._onLostFocus, this);
|
||||
L.DomEvent[onOff](window, 'focus', this._onGotFocus, this);
|
||||
|
|
|
@ -73,10 +73,6 @@ L.Map.Mouse = L.Handler.extend({
|
|||
if (mouseEnteringLeavingMap && e.type === 'mouseover' && this._mouseDown) {
|
||||
L.DomEvent.off(document, 'mousemove', this._onMouseMoveOutside, this);
|
||||
L.DomEvent.off(document, 'mouseup', this._onMouseUpOutside, this);
|
||||
if (this._map._resizeDetector) {
|
||||
L.DomEvent.off(this._map._resizeDetector.contentWindow, 'mousemove', this._onMouseMoveOutside, this);
|
||||
L.DomEvent.off(this._map._resizeDetector.contentWindow, 'mouseup', this._onMouseUpOutside, this);
|
||||
}
|
||||
}
|
||||
else if (e.type === 'mousedown') {
|
||||
docLayer._resetPreFetching();
|
||||
|
@ -188,10 +184,6 @@ L.Map.Mouse = L.Handler.extend({
|
|||
docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, count, buttons, modifier);
|
||||
}
|
||||
else if (mouseEnteringLeavingMap && e.type === 'mouseout' && this._mouseDown) {
|
||||
if (this._map._resizeDetector) {
|
||||
L.DomEvent.on(this._map._resizeDetector.contentWindow, 'mousemove', this._onMouseMoveOutside, this);
|
||||
L.DomEvent.on(this._map._resizeDetector.contentWindow, 'mouseup', this._onMouseUpOutside, this);
|
||||
}
|
||||
L.DomEvent.on(document, 'mousemove', this._onMouseMoveOutside, this);
|
||||
L.DomEvent.on(document, 'mouseup', this._onMouseUpOutside, this);
|
||||
}
|
||||
|
@ -216,10 +208,6 @@ L.Map.Mouse = L.Handler.extend({
|
|||
this._mouseDown = false;
|
||||
L.DomEvent.off(document, 'mousemove', this._onMouseMoveOutside, this);
|
||||
L.DomEvent.off(document, 'mouseup', this._onMouseUpOutside, this);
|
||||
if (this._map._resizeDetector) {
|
||||
L.DomEvent.off(this._map._resizeDetector.contentWindow, 'mousemove', this._onMouseMoveOutside, this);
|
||||
L.DomEvent.off(this._map._resizeDetector.contentWindow, 'mouseup', this._onMouseUpOutside, this);
|
||||
}
|
||||
|
||||
this._map._handleDOMEvent(e);
|
||||
if (this._map.dragging.enabled()) {
|
||||
|
|
Loading…
Reference in a new issue