update dialog, draw, and sock.js libs
@ -12,11 +12,11 @@ dialog {
|
|||||||
padding: 1em;
|
padding: 1em;
|
||||||
background: white;
|
background: white;
|
||||||
color: black;
|
color: black;
|
||||||
display: none;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog[open] {
|
dialog:not([open]) {
|
||||||
display: block;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog + .backdrop {
|
dialog + .backdrop {
|
||||||
@ -25,16 +25,13 @@ dialog + .backdrop {
|
|||||||
background: rgba(0,0,0,0.1);
|
background: rgba(0,0,0,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for small devices, modal dialogs go full-screen */
|
|
||||||
@media screen and (max-width: 540px) {
|
|
||||||
dialog[_polyfill_modal] { /* TODO: implement */
|
|
||||||
top: 0;
|
|
||||||
width: auto;
|
|
||||||
margin: 1em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
._dialog_overlay {
|
._dialog_overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0; right: 0; bottom: 0; left: 0;
|
top: 0; right: 0; bottom: 0; left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dialog.fixed {
|
||||||
|
position: fixed;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(0, -50%);
|
||||||
|
}
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
(function() {
|
(function (global, factory) {
|
||||||
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||||
|
typeof define === 'function' && define.amd ? define(factory) :
|
||||||
|
(global = global || self, global.dialogPolyfill = factory());
|
||||||
|
}(this, function () { 'use strict';
|
||||||
|
|
||||||
|
// nb. This is for IE10 and lower _only_.
|
||||||
var supportCustomEvent = window.CustomEvent;
|
var supportCustomEvent = window.CustomEvent;
|
||||||
if (!supportCustomEvent || typeof supportCustomEvent == 'object') {
|
if (!supportCustomEvent || typeof supportCustomEvent === 'object') {
|
||||||
supportCustomEvent = function CustomEvent(event, x) {
|
supportCustomEvent = function CustomEvent(event, x) {
|
||||||
x = x || {};
|
x = x || {};
|
||||||
var ev = document.createEvent('CustomEvent');
|
var ev = document.createEvent('CustomEvent');
|
||||||
@ -11,6 +16,33 @@
|
|||||||
supportCustomEvent.prototype = window.Event.prototype;
|
supportCustomEvent.prototype = window.Event.prototype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Element} el to check for stacking context
|
||||||
|
* @return {boolean} whether this el or its parents creates a stacking context
|
||||||
|
*/
|
||||||
|
function createsStackingContext(el) {
|
||||||
|
while (el && el !== document.body) {
|
||||||
|
var s = window.getComputedStyle(el);
|
||||||
|
var invalid = function(k, ok) {
|
||||||
|
return !(s[k] === undefined || s[k] === ok);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (s.opacity < 1 ||
|
||||||
|
invalid('zIndex', 'auto') ||
|
||||||
|
invalid('transform', 'none') ||
|
||||||
|
invalid('mixBlendMode', 'normal') ||
|
||||||
|
invalid('filter', 'none') ||
|
||||||
|
invalid('perspective', 'none') ||
|
||||||
|
s['isolation'] === 'isolate' ||
|
||||||
|
s.position === 'fixed' ||
|
||||||
|
s.webkitOverflowScrolling === 'touch') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
el = el.parentElement;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the nearest <dialog> from the passed element.
|
* Finds the nearest <dialog> from the passed element.
|
||||||
*
|
*
|
||||||
@ -19,7 +51,7 @@
|
|||||||
*/
|
*/
|
||||||
function findNearestDialog(el) {
|
function findNearestDialog(el) {
|
||||||
while (el) {
|
while (el) {
|
||||||
if (el.nodeName.toUpperCase() == 'DIALOG') {
|
if (el.localName === 'dialog') {
|
||||||
return /** @type {HTMLDialogElement} */ (el);
|
return /** @type {HTMLDialogElement} */ (el);
|
||||||
}
|
}
|
||||||
el = el.parentElement;
|
el = el.parentElement;
|
||||||
@ -35,7 +67,7 @@
|
|||||||
* @param {Element} el to blur
|
* @param {Element} el to blur
|
||||||
*/
|
*/
|
||||||
function safeBlur(el) {
|
function safeBlur(el) {
|
||||||
if (el && el.blur && el != document.body) {
|
if (el && el.blur && el !== document.body) {
|
||||||
el.blur();
|
el.blur();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,13 +79,24 @@
|
|||||||
*/
|
*/
|
||||||
function inNodeList(nodeList, node) {
|
function inNodeList(nodeList, node) {
|
||||||
for (var i = 0; i < nodeList.length; ++i) {
|
for (var i = 0; i < nodeList.length; ++i) {
|
||||||
if (nodeList[i] == node) {
|
if (nodeList[i] === node) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {HTMLFormElement} el to check
|
||||||
|
* @return {boolean} whether this form has method="dialog"
|
||||||
|
*/
|
||||||
|
function isFormMethodDialog(el) {
|
||||||
|
if (!el || !el.hasAttribute('method')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return el.getAttribute('method').toLowerCase() === 'dialog';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {!HTMLDialogElement} dialog to upgrade
|
* @param {!HTMLDialogElement} dialog to upgrade
|
||||||
* @constructor
|
* @constructor
|
||||||
@ -76,13 +119,29 @@
|
|||||||
dialog.returnValue = '';
|
dialog.returnValue = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
this.maybeHideModal = this.maybeHideModal.bind(this);
|
|
||||||
if ('MutationObserver' in window) {
|
if ('MutationObserver' in window) {
|
||||||
// IE11+, most other browsers.
|
var mo = new MutationObserver(this.maybeHideModal.bind(this));
|
||||||
var mo = new MutationObserver(this.maybeHideModal);
|
|
||||||
mo.observe(dialog, {attributes: true, attributeFilter: ['open']});
|
mo.observe(dialog, {attributes: true, attributeFilter: ['open']});
|
||||||
} else {
|
} else {
|
||||||
dialog.addEventListener('DOMAttrModified', this.maybeHideModal);
|
// IE10 and below support. Note that DOMNodeRemoved etc fire _before_ removal. They also
|
||||||
|
// seem to fire even if the element was removed as part of a parent removal. Use the removed
|
||||||
|
// events to force downgrade (useful if removed/immediately added).
|
||||||
|
var removed = false;
|
||||||
|
var cb = function() {
|
||||||
|
removed ? this.downgradeModal() : this.maybeHideModal();
|
||||||
|
removed = false;
|
||||||
|
}.bind(this);
|
||||||
|
var timeout;
|
||||||
|
var delayModel = function(ev) {
|
||||||
|
if (ev.target !== dialog) { return; } // not for a child element
|
||||||
|
var cand = 'DOMNodeRemoved';
|
||||||
|
removed |= (ev.type.substr(0, cand.length) === cand);
|
||||||
|
window.clearTimeout(timeout);
|
||||||
|
timeout = window.setTimeout(cb, 0);
|
||||||
|
};
|
||||||
|
['DOMAttrModified', 'DOMNodeRemoved', 'DOMNodeRemovedFromDocument'].forEach(function(name) {
|
||||||
|
dialog.addEventListener(name, delayModel);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
// Note that the DOM is observed inside DialogManager while any dialog
|
// Note that the DOM is observed inside DialogManager while any dialog
|
||||||
// is being displayed as a modal, to catch modal removal from the DOM.
|
// is being displayed as a modal, to catch modal removal from the DOM.
|
||||||
@ -94,7 +153,7 @@
|
|||||||
|
|
||||||
this.backdrop_ = document.createElement('div');
|
this.backdrop_ = document.createElement('div');
|
||||||
this.backdrop_.className = 'backdrop';
|
this.backdrop_.className = 'backdrop';
|
||||||
this.backdropClick_ = this.backdropClick_.bind(this);
|
this.backdrop_.addEventListener('click', this.backdropClick_.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogPolyfillInfo.prototype = {
|
dialogPolyfillInfo.prototype = {
|
||||||
@ -109,26 +168,28 @@
|
|||||||
* longer open or is no longer part of the DOM.
|
* longer open or is no longer part of the DOM.
|
||||||
*/
|
*/
|
||||||
maybeHideModal: function() {
|
maybeHideModal: function() {
|
||||||
if (!this.openAsModal_) { return; }
|
if (this.dialog_.hasAttribute('open') && document.body.contains(this.dialog_)) { return; }
|
||||||
if (this.dialog_.hasAttribute('open') &&
|
this.downgradeModal();
|
||||||
document.body.contains(this.dialog_)) { return; }
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove this dialog from the modal top layer, leaving it as a non-modal.
|
||||||
|
*/
|
||||||
|
downgradeModal: function() {
|
||||||
|
if (!this.openAsModal_) { return; }
|
||||||
this.openAsModal_ = false;
|
this.openAsModal_ = false;
|
||||||
this.dialog_.style.zIndex = '';
|
this.dialog_.style.zIndex = '';
|
||||||
|
|
||||||
// This won't match the native <dialog> exactly because if the user set
|
// This won't match the native <dialog> exactly because if the user set top on a centered
|
||||||
// top on a centered polyfill dialog, that top gets thrown away when the
|
// polyfill dialog, that top gets thrown away when the dialog is closed. Not sure it's
|
||||||
// dialog is closed. Not sure it's possible to polyfill this perfectly.
|
// possible to polyfill this perfectly.
|
||||||
if (this.replacedStyleTop_) {
|
if (this.replacedStyleTop_) {
|
||||||
this.dialog_.style.top = '';
|
this.dialog_.style.top = '';
|
||||||
this.replacedStyleTop_ = false;
|
this.replacedStyleTop_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optimistically clear the modal part of this <dialog>.
|
// Clear the backdrop and remove from the manager.
|
||||||
this.backdrop_.removeEventListener('click', this.backdropClick_);
|
this.backdrop_.parentNode && this.backdrop_.parentNode.removeChild(this.backdrop_);
|
||||||
if (this.backdrop_.parentElement) {
|
|
||||||
this.backdrop_.parentElement.removeChild(this.backdrop_);
|
|
||||||
}
|
|
||||||
dialogPolyfill.dm.removeDialog(this);
|
dialogPolyfill.dm.removeDialog(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -151,6 +212,19 @@
|
|||||||
* @param {!Event} e to redirect
|
* @param {!Event} e to redirect
|
||||||
*/
|
*/
|
||||||
backdropClick_: function(e) {
|
backdropClick_: function(e) {
|
||||||
|
if (!this.dialog_.hasAttribute('tabindex')) {
|
||||||
|
// Clicking on the backdrop should move the implicit cursor, even if dialog cannot be
|
||||||
|
// focused. Create a fake thing to focus on. If the backdrop was _before_ the dialog, this
|
||||||
|
// would not be needed - clicks would move the implicit cursor there.
|
||||||
|
var fake = document.createElement('div');
|
||||||
|
this.dialog_.insertBefore(fake, this.dialog_.firstChild);
|
||||||
|
fake.tabIndex = -1;
|
||||||
|
fake.focus();
|
||||||
|
this.dialog_.removeChild(fake);
|
||||||
|
} else {
|
||||||
|
this.dialog_.focus();
|
||||||
|
}
|
||||||
|
|
||||||
var redirectedEvent = document.createEvent('MouseEvents');
|
var redirectedEvent = document.createEvent('MouseEvents');
|
||||||
redirectedEvent.initMouseEvent(e.type, e.bubbles, e.cancelable, window,
|
redirectedEvent.initMouseEvent(e.type, e.bubbles, e.cancelable, window,
|
||||||
e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey,
|
e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey,
|
||||||
@ -166,6 +240,9 @@
|
|||||||
focus_: function() {
|
focus_: function() {
|
||||||
// Find element with `autofocus` attribute, or fall back to the first form/tabindex control.
|
// Find element with `autofocus` attribute, or fall back to the first form/tabindex control.
|
||||||
var target = this.dialog_.querySelector('[autofocus]:not([disabled])');
|
var target = this.dialog_.querySelector('[autofocus]:not([disabled])');
|
||||||
|
if (!target && this.dialog_.tabIndex >= 0) {
|
||||||
|
target = this.dialog_;
|
||||||
|
}
|
||||||
if (!target) {
|
if (!target) {
|
||||||
// Note that this is 'any focusable area'. This list is probably not exhaustive, but the
|
// Note that this is 'any focusable area'. This list is probably not exhaustive, but the
|
||||||
// alternative involves stepping through and trying to focus everything.
|
// alternative involves stepping through and trying to focus everything.
|
||||||
@ -184,12 +261,15 @@
|
|||||||
/**
|
/**
|
||||||
* Sets the zIndex for the backdrop and dialog.
|
* Sets the zIndex for the backdrop and dialog.
|
||||||
*
|
*
|
||||||
* @param {number} backdropZ
|
|
||||||
* @param {number} dialogZ
|
* @param {number} dialogZ
|
||||||
|
* @param {number} backdropZ
|
||||||
*/
|
*/
|
||||||
updateZIndex: function(backdropZ, dialogZ) {
|
updateZIndex: function(dialogZ, backdropZ) {
|
||||||
this.backdrop_.style.zIndex = backdropZ;
|
if (dialogZ < backdropZ) {
|
||||||
|
throw new Error('dialogZ should never be < backdropZ');
|
||||||
|
}
|
||||||
this.dialog_.style.zIndex = dialogZ;
|
this.dialog_.style.zIndex = dialogZ;
|
||||||
|
this.backdrop_.style.zIndex = backdropZ;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -215,7 +295,14 @@
|
|||||||
if (!dialogPolyfill.dm.pushDialog(this)) {
|
if (!dialogPolyfill.dm.pushDialog(this)) {
|
||||||
throw new Error('Failed to execute \'showModal\' on dialog: There are too many open modal dialogs.');
|
throw new Error('Failed to execute \'showModal\' on dialog: There are too many open modal dialogs.');
|
||||||
}
|
}
|
||||||
this.show();
|
|
||||||
|
if (createsStackingContext(this.dialog_.parentElement)) {
|
||||||
|
console.warn('A dialog is being shown inside a stacking context. ' +
|
||||||
|
'This may cause it to be unusable. For more information, see this link: ' +
|
||||||
|
'https://github.com/GoogleChrome/dialog-polyfill/#stacking-context');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setOpen(true);
|
||||||
this.openAsModal_ = true;
|
this.openAsModal_ = true;
|
||||||
|
|
||||||
// Optionally center vertically, relative to the current viewport.
|
// Optionally center vertically, relative to the current viewport.
|
||||||
@ -227,9 +314,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert backdrop.
|
// Insert backdrop.
|
||||||
this.backdrop_.addEventListener('click', this.backdropClick_);
|
this.dialog_.parentNode.insertBefore(this.backdrop_, this.dialog_.nextSibling);
|
||||||
this.dialog_.parentNode.insertBefore(this.backdrop_,
|
|
||||||
this.dialog_.nextSibling);
|
// Focus on whatever inside the dialog.
|
||||||
|
this.focus_();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -275,8 +363,7 @@
|
|||||||
try {
|
try {
|
||||||
cssRules = styleSheet.cssRules;
|
cssRules = styleSheet.cssRules;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
if (!cssRules)
|
if (!cssRules) { continue; }
|
||||||
continue;
|
|
||||||
for (var j = 0; j < cssRules.length; ++j) {
|
for (var j = 0; j < cssRules.length; ++j) {
|
||||||
var rule = cssRules[j];
|
var rule = cssRules[j];
|
||||||
var selectedNodes = null;
|
var selectedNodes = null;
|
||||||
@ -284,20 +371,22 @@
|
|||||||
try {
|
try {
|
||||||
selectedNodes = document.querySelectorAll(rule.selectorText);
|
selectedNodes = document.querySelectorAll(rule.selectorText);
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
if (!selectedNodes || !inNodeList(selectedNodes, element))
|
if (!selectedNodes || !inNodeList(selectedNodes, element)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
var cssTop = rule.style.getPropertyValue('top');
|
var cssTop = rule.style.getPropertyValue('top');
|
||||||
var cssBottom = rule.style.getPropertyValue('bottom');
|
var cssBottom = rule.style.getPropertyValue('bottom');
|
||||||
if ((cssTop && cssTop != 'auto') || (cssBottom && cssBottom != 'auto'))
|
if ((cssTop && cssTop !== 'auto') || (cssBottom && cssBottom !== 'auto')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
dialogPolyfill.needsCentering = function(dialog) {
|
dialogPolyfill.needsCentering = function(dialog) {
|
||||||
var computedStyle = window.getComputedStyle(dialog);
|
var computedStyle = window.getComputedStyle(dialog);
|
||||||
if (computedStyle.position != 'absolute') {
|
if (computedStyle.position !== 'absolute') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,9 +394,10 @@
|
|||||||
// WebKit/Blink, checking computedStyle.top == 'auto' is sufficient, but
|
// WebKit/Blink, checking computedStyle.top == 'auto' is sufficient, but
|
||||||
// Firefox returns the used value. So we do this crazy thing instead: check
|
// Firefox returns the used value. So we do this crazy thing instead: check
|
||||||
// the inline style and then go through CSS rules.
|
// the inline style and then go through CSS rules.
|
||||||
if ((dialog.style.top != 'auto' && dialog.style.top != '') ||
|
if ((dialog.style.top !== 'auto' && dialog.style.top !== '') ||
|
||||||
(dialog.style.bottom != 'auto' && dialog.style.bottom != ''))
|
(dialog.style.bottom !== 'auto' && dialog.style.bottom !== '')) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return !dialogPolyfill.isInlinePositionSetByStylesheet(dialog);
|
return !dialogPolyfill.isInlinePositionSetByStylesheet(dialog);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -315,23 +405,21 @@
|
|||||||
* @param {!Element} element to force upgrade
|
* @param {!Element} element to force upgrade
|
||||||
*/
|
*/
|
||||||
dialogPolyfill.forceRegisterDialog = function(element) {
|
dialogPolyfill.forceRegisterDialog = function(element) {
|
||||||
if (element.showModal) {
|
if (window.HTMLDialogElement || element.showModal) {
|
||||||
console.warn('This browser already supports <dialog>, the polyfill ' +
|
console.warn('This browser already supports <dialog>, the polyfill ' +
|
||||||
'may not work correctly', element);
|
'may not work correctly', element);
|
||||||
}
|
}
|
||||||
if (element.nodeName.toUpperCase() != 'DIALOG') {
|
if (element.localName !== 'dialog') {
|
||||||
throw new Error('Failed to register dialog: The element is not a dialog.');
|
throw new Error('Failed to register dialog: The element is not a dialog.');
|
||||||
}
|
}
|
||||||
new dialogPolyfillInfo(/** @type {!HTMLDialogElement} */ (element));
|
new dialogPolyfillInfo(/** @type {!HTMLDialogElement} */ (element));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {!Element} element to upgrade
|
* @param {!Element} element to upgrade, if necessary
|
||||||
*/
|
*/
|
||||||
dialogPolyfill.registerDialog = function(element) {
|
dialogPolyfill.registerDialog = function(element) {
|
||||||
if (element.showModal) {
|
if (!element.showModal) {
|
||||||
console.warn('Can\'t upgrade <dialog>: already supported', element);
|
|
||||||
} else {
|
|
||||||
dialogPolyfill.forceRegisterDialog(element);
|
dialogPolyfill.forceRegisterDialog(element);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -343,6 +431,8 @@
|
|||||||
/** @type {!Array<!dialogPolyfillInfo>} */
|
/** @type {!Array<!dialogPolyfillInfo>} */
|
||||||
this.pendingDialogStack = [];
|
this.pendingDialogStack = [];
|
||||||
|
|
||||||
|
var checkDOM = this.checkDOM_.bind(this);
|
||||||
|
|
||||||
// The overlay is used to simulate how a modal dialog blocks the document.
|
// The overlay is used to simulate how a modal dialog blocks the document.
|
||||||
// The blocking dialog is positioned on top of the overlay, and the rest of
|
// The blocking dialog is positioned on top of the overlay, and the rest of
|
||||||
// the dialogs on the pending dialog stack are positioned below it. In the
|
// the dialogs on the pending dialog stack are positioned below it. In the
|
||||||
@ -351,26 +441,35 @@
|
|||||||
this.overlay = document.createElement('div');
|
this.overlay = document.createElement('div');
|
||||||
this.overlay.className = '_dialog_overlay';
|
this.overlay.className = '_dialog_overlay';
|
||||||
this.overlay.addEventListener('click', function(e) {
|
this.overlay.addEventListener('click', function(e) {
|
||||||
|
this.forwardTab_ = undefined;
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
checkDOM([]); // sanity-check DOM
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
this.handleKey_ = this.handleKey_.bind(this);
|
this.handleKey_ = this.handleKey_.bind(this);
|
||||||
this.handleFocus_ = this.handleFocus_.bind(this);
|
this.handleFocus_ = this.handleFocus_.bind(this);
|
||||||
this.handleRemove_ = this.handleRemove_.bind(this);
|
|
||||||
|
|
||||||
this.zIndexLow_ = 100000;
|
this.zIndexLow_ = 100000;
|
||||||
this.zIndexHigh_ = 100000 + 150;
|
this.zIndexHigh_ = 100000 + 150;
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
this.forwardTab_ = undefined;
|
||||||
* @return {Element} the top HTML dialog element, if any
|
|
||||||
*/
|
if ('MutationObserver' in window) {
|
||||||
dialogPolyfill.DialogManager.prototype.topDialogElement = function() {
|
this.mo_ = new MutationObserver(function(records) {
|
||||||
if (this.pendingDialogStack.length) {
|
var removed = [];
|
||||||
var t = this.pendingDialogStack[this.pendingDialogStack.length - 1];
|
records.forEach(function(rec) {
|
||||||
return t.dialog;
|
for (var i = 0, c; c = rec.removedNodes[i]; ++i) {
|
||||||
|
if (!(c instanceof Element)) {
|
||||||
|
continue;
|
||||||
|
} else if (c.localName === 'dialog') {
|
||||||
|
removed.push(c);
|
||||||
|
}
|
||||||
|
removed = removed.concat(c.querySelectorAll('dialog'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
removed.length && checkDOM(removed);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -378,10 +477,9 @@
|
|||||||
* handlers.
|
* handlers.
|
||||||
*/
|
*/
|
||||||
dialogPolyfill.DialogManager.prototype.blockDocument = function() {
|
dialogPolyfill.DialogManager.prototype.blockDocument = function() {
|
||||||
document.body.appendChild(this.overlay);
|
document.documentElement.addEventListener('focus', this.handleFocus_, true);
|
||||||
document.body.addEventListener('focus', this.handleFocus_, true);
|
|
||||||
document.addEventListener('keydown', this.handleKey_);
|
document.addEventListener('keydown', this.handleKey_);
|
||||||
document.addEventListener('DOMNodeRemoved', this.handleRemove_);
|
this.mo_ && this.mo_.observe(document, {childList: true, subtree: true});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -389,63 +487,111 @@
|
|||||||
* dialogs are visible.
|
* dialogs are visible.
|
||||||
*/
|
*/
|
||||||
dialogPolyfill.DialogManager.prototype.unblockDocument = function() {
|
dialogPolyfill.DialogManager.prototype.unblockDocument = function() {
|
||||||
document.body.removeChild(this.overlay);
|
document.documentElement.removeEventListener('focus', this.handleFocus_, true);
|
||||||
document.body.removeEventListener('focus', this.handleFocus_, true);
|
|
||||||
document.removeEventListener('keydown', this.handleKey_);
|
document.removeEventListener('keydown', this.handleKey_);
|
||||||
document.removeEventListener('DOMNodeRemoved', this.handleRemove_);
|
this.mo_ && this.mo_.disconnect();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the stacking of all known dialogs.
|
||||||
|
*/
|
||||||
dialogPolyfill.DialogManager.prototype.updateStacking = function() {
|
dialogPolyfill.DialogManager.prototype.updateStacking = function() {
|
||||||
var zIndex = this.zIndexLow_;
|
var zIndex = this.zIndexHigh_;
|
||||||
|
|
||||||
for (var i = 0; i < this.pendingDialogStack.length; i++) {
|
for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) {
|
||||||
if (i == this.pendingDialogStack.length - 1) {
|
dpi.updateZIndex(--zIndex, --zIndex);
|
||||||
this.overlay.style.zIndex = zIndex++;
|
if (i === 0) {
|
||||||
|
this.overlay.style.zIndex = --zIndex;
|
||||||
}
|
}
|
||||||
this.pendingDialogStack[i].updateZIndex(zIndex++, zIndex++);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make the overlay a sibling of the dialog itself.
|
||||||
|
var last = this.pendingDialogStack[0];
|
||||||
|
if (last) {
|
||||||
|
var p = last.dialog.parentNode || document.body;
|
||||||
|
p.appendChild(this.overlay);
|
||||||
|
} else if (this.overlay.parentNode) {
|
||||||
|
this.overlay.parentNode.removeChild(this.overlay);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Element} candidate to check if contained or is the top-most modal dialog
|
||||||
|
* @return {boolean} whether candidate is contained in top dialog
|
||||||
|
*/
|
||||||
|
dialogPolyfill.DialogManager.prototype.containedByTopDialog_ = function(candidate) {
|
||||||
|
while (candidate = findNearestDialog(candidate)) {
|
||||||
|
for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) {
|
||||||
|
if (dpi.dialog === candidate) {
|
||||||
|
return i === 0; // only valid if top-most
|
||||||
|
}
|
||||||
|
}
|
||||||
|
candidate = candidate.parentElement;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
dialogPolyfill.DialogManager.prototype.handleFocus_ = function(event) {
|
dialogPolyfill.DialogManager.prototype.handleFocus_ = function(event) {
|
||||||
var candidate = findNearestDialog(/** @type {Element} */ (event.target));
|
if (this.containedByTopDialog_(event.target)) { return; }
|
||||||
if (candidate != this.topDialogElement()) {
|
|
||||||
|
if (document.activeElement === document.documentElement) { return; }
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
safeBlur(/** @type {Element} */ (event.target));
|
safeBlur(/** @type {Element} */ (event.target));
|
||||||
// TODO: Focus on the browser chrome (aka document) or the dialog itself
|
|
||||||
// depending on the tab direction.
|
if (this.forwardTab_ === undefined) { return; } // move focus only from a tab key
|
||||||
return false;
|
|
||||||
|
var dpi = this.pendingDialogStack[0];
|
||||||
|
var dialog = dpi.dialog;
|
||||||
|
var position = dialog.compareDocumentPosition(event.target);
|
||||||
|
if (position & Node.DOCUMENT_POSITION_PRECEDING) {
|
||||||
|
if (this.forwardTab_) {
|
||||||
|
// forward
|
||||||
|
dpi.focus_();
|
||||||
|
} else if (event.target !== document.documentElement) {
|
||||||
|
// backwards if we're not already focused on <html>
|
||||||
|
document.documentElement.focus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
dialogPolyfill.DialogManager.prototype.handleKey_ = function(event) {
|
dialogPolyfill.DialogManager.prototype.handleKey_ = function(event) {
|
||||||
if (event.keyCode == 27) {
|
this.forwardTab_ = undefined;
|
||||||
|
if (event.keyCode === 27) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
var cancelEvent = new supportCustomEvent('cancel', {
|
var cancelEvent = new supportCustomEvent('cancel', {
|
||||||
bubbles: false,
|
bubbles: false,
|
||||||
cancelable: true
|
cancelable: true
|
||||||
});
|
});
|
||||||
var dialog = this.topDialogElement();
|
var dpi = this.pendingDialogStack[0];
|
||||||
if (dialog.dispatchEvent(cancelEvent)) {
|
if (dpi && dpi.dialog.dispatchEvent(cancelEvent)) {
|
||||||
dialog.close();
|
dpi.dialog.close();
|
||||||
}
|
}
|
||||||
|
} else if (event.keyCode === 9) {
|
||||||
|
this.forwardTab_ = !event.shiftKey;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
dialogPolyfill.DialogManager.prototype.handleRemove_ = function(event) {
|
/**
|
||||||
if (event.target.nodeName.toUpperCase() != 'DIALOG') { return; }
|
* Finds and downgrades any known modal dialogs that are no longer displayed. Dialogs that are
|
||||||
|
* removed and immediately readded don't stay modal, they become normal.
|
||||||
var dialog = /** @type {HTMLDialogElement} */ (event.target);
|
*
|
||||||
if (!dialog.open) { return; }
|
* @param {!Array<!HTMLDialogElement>} removed that have definitely been removed
|
||||||
|
*/
|
||||||
// Find a dialogPolyfillInfo which matches the removed <dialog>.
|
dialogPolyfill.DialogManager.prototype.checkDOM_ = function(removed) {
|
||||||
this.pendingDialogStack.some(function(dpi) {
|
// This operates on a clone because it may cause it to change. Each change also calls
|
||||||
if (dpi.dialog == dialog) {
|
// updateStacking, which only actually needs to happen once. But who removes many modal dialogs
|
||||||
// This call will clear the dialogPolyfillInfo on this DialogManager
|
// at a time?!
|
||||||
// as a side effect.
|
var clone = this.pendingDialogStack.slice();
|
||||||
|
clone.forEach(function(dpi) {
|
||||||
|
if (removed.indexOf(dpi.dialog) !== -1) {
|
||||||
|
dpi.downgradeModal();
|
||||||
|
} else {
|
||||||
dpi.maybeHideModal();
|
dpi.maybeHideModal();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -459,8 +605,7 @@
|
|||||||
if (this.pendingDialogStack.length >= allowed) {
|
if (this.pendingDialogStack.length >= allowed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.pendingDialogStack.push(dpi);
|
if (this.pendingDialogStack.unshift(dpi) === 1) {
|
||||||
if (this.pendingDialogStack.length == 1) {
|
|
||||||
this.blockDocument();
|
this.blockDocument();
|
||||||
}
|
}
|
||||||
this.updateStacking();
|
this.updateStacking();
|
||||||
@ -468,59 +613,124 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {dialogPolyfillInfo} dpi
|
* @param {!dialogPolyfillInfo} dpi
|
||||||
*/
|
*/
|
||||||
dialogPolyfill.DialogManager.prototype.removeDialog = function(dpi) {
|
dialogPolyfill.DialogManager.prototype.removeDialog = function(dpi) {
|
||||||
var index = this.pendingDialogStack.indexOf(dpi);
|
var index = this.pendingDialogStack.indexOf(dpi);
|
||||||
if (index == -1) { return; }
|
if (index === -1) { return; }
|
||||||
|
|
||||||
this.pendingDialogStack.splice(index, 1);
|
this.pendingDialogStack.splice(index, 1);
|
||||||
this.updateStacking();
|
if (this.pendingDialogStack.length === 0) {
|
||||||
if (this.pendingDialogStack.length == 0) {
|
|
||||||
this.unblockDocument();
|
this.unblockDocument();
|
||||||
}
|
}
|
||||||
|
this.updateStacking();
|
||||||
};
|
};
|
||||||
|
|
||||||
dialogPolyfill.dm = new dialogPolyfill.DialogManager();
|
dialogPolyfill.dm = new dialogPolyfill.DialogManager();
|
||||||
|
dialogPolyfill.formSubmitter = null;
|
||||||
|
dialogPolyfill.useValue = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Installs global handlers, such as click listers and native method overrides. These are needed
|
||||||
|
* even if a no dialog is registered, as they deal with <form method="dialog">.
|
||||||
|
*/
|
||||||
|
if (window.HTMLDialogElement === undefined) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If HTMLFormElement translates method="DIALOG" into 'get', then replace the descriptor with
|
||||||
|
* one that returns the correct value.
|
||||||
|
*/
|
||||||
|
var testForm = document.createElement('form');
|
||||||
|
testForm.setAttribute('method', 'dialog');
|
||||||
|
if (testForm.method !== 'dialog') {
|
||||||
|
var methodDescriptor = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, 'method');
|
||||||
|
if (methodDescriptor) {
|
||||||
|
// nb. Some older iOS and older PhantomJS fail to return the descriptor. Don't do anything
|
||||||
|
// and don't bother to update the element.
|
||||||
|
var realGet = methodDescriptor.get;
|
||||||
|
methodDescriptor.get = function() {
|
||||||
|
if (isFormMethodDialog(this)) {
|
||||||
|
return 'dialog';
|
||||||
|
}
|
||||||
|
return realGet.call(this);
|
||||||
|
};
|
||||||
|
var realSet = methodDescriptor.set;
|
||||||
|
methodDescriptor.set = function(v) {
|
||||||
|
if (typeof v === 'string' && v.toLowerCase() === 'dialog') {
|
||||||
|
return this.setAttribute('method', v);
|
||||||
|
}
|
||||||
|
return realSet.call(this, v);
|
||||||
|
};
|
||||||
|
Object.defineProperty(HTMLFormElement.prototype, 'method', methodDescriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global 'click' handler, to capture the <input type="submit"> or <button> element which has
|
||||||
|
* submitted a <form method="dialog">. Needed as Safari and others don't report this inside
|
||||||
|
* document.activeElement.
|
||||||
|
*/
|
||||||
|
document.addEventListener('click', function(ev) {
|
||||||
|
dialogPolyfill.formSubmitter = null;
|
||||||
|
dialogPolyfill.useValue = null;
|
||||||
|
if (ev.defaultPrevented) { return; } // e.g. a submit which prevents default submission
|
||||||
|
|
||||||
|
var target = /** @type {Element} */ (ev.target);
|
||||||
|
if (!target || !isFormMethodDialog(target.form)) { return; }
|
||||||
|
|
||||||
|
var valid = (target.type === 'submit' && ['button', 'input'].indexOf(target.localName) > -1);
|
||||||
|
if (!valid) {
|
||||||
|
if (!(target.localName === 'input' && target.type === 'image')) { return; }
|
||||||
|
// this is a <input type="image">, which can submit forms
|
||||||
|
dialogPolyfill.useValue = ev.offsetX + ',' + ev.offsetY;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dialog = findNearestDialog(target);
|
||||||
|
if (!dialog) { return; }
|
||||||
|
|
||||||
|
dialogPolyfill.formSubmitter = target;
|
||||||
|
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace the native HTMLFormElement.submit() method, as it won't fire the
|
||||||
|
* submit event and give us a chance to respond.
|
||||||
|
*/
|
||||||
|
var nativeFormSubmit = HTMLFormElement.prototype.submit;
|
||||||
|
var replacementFormSubmit = function () {
|
||||||
|
if (!isFormMethodDialog(this)) {
|
||||||
|
return nativeFormSubmit.call(this);
|
||||||
|
}
|
||||||
|
var dialog = findNearestDialog(this);
|
||||||
|
dialog && dialog.close();
|
||||||
|
};
|
||||||
|
HTMLFormElement.prototype.submit = replacementFormSubmit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global form 'dialog' method handler. Closes a dialog correctly on submit
|
* Global form 'dialog' method handler. Closes a dialog correctly on submit
|
||||||
* and possibly sets its return value.
|
* and possibly sets its return value.
|
||||||
*/
|
*/
|
||||||
document.addEventListener('submit', function(ev) {
|
document.addEventListener('submit', function(ev) {
|
||||||
var target = ev.target;
|
var form = /** @type {HTMLFormElement} */ (ev.target);
|
||||||
if (!target || !target.hasAttribute('method')) { return; }
|
if (!isFormMethodDialog(form)) { return; }
|
||||||
if (target.getAttribute('method').toLowerCase() != 'dialog') { return; }
|
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
var dialog = findNearestDialog(/** @type {Element} */ (ev.target));
|
var dialog = findNearestDialog(form);
|
||||||
if (!dialog) { return; }
|
if (!dialog) { return; }
|
||||||
|
|
||||||
// FIXME: The original event doesn't contain the element used to submit the
|
// Forms can only be submitted via .submit() or a click (?), but anyway: sanity-check that
|
||||||
// form (if any). Look in some possible places.
|
// the submitter is correct before using its value as .returnValue.
|
||||||
var returnValue;
|
var s = dialogPolyfill.formSubmitter;
|
||||||
var cands = [document.activeElement, ev.explicitOriginalTarget];
|
if (s && s.form === form) {
|
||||||
var els = ['BUTTON', 'INPUT'];
|
dialog.close(dialogPolyfill.useValue || s.value);
|
||||||
cands.some(function(cand) {
|
|
||||||
if (cand && cand.form == ev.target && els.indexOf(cand.nodeName.toUpperCase()) != -1) {
|
|
||||||
returnValue = cand.value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
dialog.close(returnValue);
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
dialogPolyfill['forceRegisterDialog'] = dialogPolyfill.forceRegisterDialog;
|
|
||||||
dialogPolyfill['registerDialog'] = dialogPolyfill.registerDialog;
|
|
||||||
|
|
||||||
if (typeof define === 'function' && 'amd' in define) {
|
|
||||||
// AMD support
|
|
||||||
define(function() { return dialogPolyfill; });
|
|
||||||
} else if (typeof module === 'object' && typeof module['exports'] === 'object') {
|
|
||||||
// CommonJS support
|
|
||||||
module['exports'] = dialogPolyfill;
|
|
||||||
} else {
|
} else {
|
||||||
// all others
|
dialog.close();
|
||||||
window['dialogPolyfill'] = dialogPolyfill;
|
|
||||||
}
|
}
|
||||||
})();
|
dialogPolyfill.formSubmitter = null;
|
||||||
|
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dialogPolyfill;
|
||||||
|
|
||||||
|
}));
|
||||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.9 KiB |
156
worldmap/leaflet/images/spritesheet.svg
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
viewBox="0 0 600 60"
|
||||||
|
height="60"
|
||||||
|
width="600"
|
||||||
|
id="svg4225"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="spritesheet.svg"
|
||||||
|
inkscape:export-filename="/home/fpuga/development/upstream/icarto.Leaflet.draw/src/images/spritesheet-2x.png"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-ydpi="90">
|
||||||
|
<metadata
|
||||||
|
id="metadata4258">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs4256" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1056"
|
||||||
|
id="namedview4254"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="1.3101852"
|
||||||
|
inkscape:cx="237.56928"
|
||||||
|
inkscape:cy="7.2419621"
|
||||||
|
inkscape:window-x="1920"
|
||||||
|
inkscape:window-y="24"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg4225" />
|
||||||
|
<g
|
||||||
|
id="enabled"
|
||||||
|
style="fill:#464646;fill-opacity:1">
|
||||||
|
<g
|
||||||
|
id="polyline"
|
||||||
|
style="fill:#464646;fill-opacity:1">
|
||||||
|
<path
|
||||||
|
d="m 18,36 0,6 6,0 0,-6 -6,0 z m 4,4 -2,0 0,-2 2,0 0,2 z"
|
||||||
|
id="path4229"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#464646;fill-opacity:1" />
|
||||||
|
<path
|
||||||
|
d="m 36,18 0,6 6,0 0,-6 -6,0 z m 4,4 -2,0 0,-2 2,0 0,2 z"
|
||||||
|
id="path4231"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#464646;fill-opacity:1" />
|
||||||
|
<path
|
||||||
|
d="m 23.142,39.145 -2.285,-2.29 16,-15.998 2.285,2.285 z"
|
||||||
|
id="path4233"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#464646;fill-opacity:1" />
|
||||||
|
</g>
|
||||||
|
<path
|
||||||
|
id="polygon"
|
||||||
|
d="M 100,24.565 97.904,39.395 83.07,42 76,28.773 86.463,18 Z"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#464646;fill-opacity:1" />
|
||||||
|
<path
|
||||||
|
id="rectangle"
|
||||||
|
d="m 140,20 20,0 0,20 -20,0 z"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#464646;fill-opacity:1" />
|
||||||
|
<path
|
||||||
|
id="circle"
|
||||||
|
d="m 221,30 c 0,6.078 -4.926,11 -11,11 -6.074,0 -11,-4.922 -11,-11 0,-6.074 4.926,-11 11,-11 6.074,0 11,4.926 11,11 z"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#464646;fill-opacity:1" />
|
||||||
|
<path
|
||||||
|
id="marker"
|
||||||
|
d="m 270,19 c -4.971,0 -9,4.029 -9,9 0,4.971 5.001,12 9,14 4.001,-2 9,-9.029 9,-14 0,-4.971 -4.029,-9 -9,-9 z m 0,12.5 c -2.484,0 -4.5,-2.014 -4.5,-4.5 0,-2.484 2.016,-4.5 4.5,-4.5 2.485,0 4.5,2.016 4.5,4.5 0,2.486 -2.015,4.5 -4.5,4.5 z"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#464646;fill-opacity:1" />
|
||||||
|
<g
|
||||||
|
id="edit"
|
||||||
|
style="fill:#464646;fill-opacity:1">
|
||||||
|
<path
|
||||||
|
d="m 337,30.156 0,0.407 0,5.604 c 0,1.658 -1.344,3 -3,3 l -10,0 c -1.655,0 -3,-1.342 -3,-3 l 0,-10 c 0,-1.657 1.345,-3 3,-3 l 6.345,0 3.19,-3.17 -9.535,0 c -3.313,0 -6,2.687 -6,6 l 0,10 c 0,3.313 2.687,6 6,6 l 10,0 c 3.314,0 6,-2.687 6,-6 l 0,-8.809 -3,2.968"
|
||||||
|
id="path4240"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#464646;fill-opacity:1" />
|
||||||
|
<path
|
||||||
|
d="m 338.72,24.637 -8.892,8.892 -2.828,0 0,-2.829 8.89,-8.89 z"
|
||||||
|
id="path4242"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#464646;fill-opacity:1" />
|
||||||
|
<path
|
||||||
|
d="m 338.697,17.826 4,0 0,4 -4,0 z"
|
||||||
|
transform="matrix(-0.70698336,-0.70723018,0.70723018,-0.70698336,567.55917,274.78273)"
|
||||||
|
id="path4244"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#464646;fill-opacity:1" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="remove"
|
||||||
|
style="fill:#464646;fill-opacity:1">
|
||||||
|
<path
|
||||||
|
d="m 381,42 18,0 0,-18 -18,0 0,18 z m 14,-16 2,0 0,14 -2,0 0,-14 z m -4,0 2,0 0,14 -2,0 0,-14 z m -4,0 2,0 0,14 -2,0 0,-14 z m -4,0 2,0 0,14 -2,0 0,-14 z"
|
||||||
|
id="path4247"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#464646;fill-opacity:1" />
|
||||||
|
<path
|
||||||
|
d="m 395,20 0,-4 -10,0 0,4 -6,0 0,2 22,0 0,-2 -6,0 z m -2,0 -6,0 0,-2 6,0 0,2 z"
|
||||||
|
id="path4249"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#464646;fill-opacity:1" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="disabled"
|
||||||
|
transform="translate(120,0)"
|
||||||
|
style="fill:#bbbbbb">
|
||||||
|
<use
|
||||||
|
xlink:href="#edit"
|
||||||
|
id="edit-disabled"
|
||||||
|
x="0"
|
||||||
|
y="0"
|
||||||
|
width="100%"
|
||||||
|
height="100%" />
|
||||||
|
<use
|
||||||
|
xlink:href="#remove"
|
||||||
|
id="remove-disabled"
|
||||||
|
x="0"
|
||||||
|
y="0"
|
||||||
|
width="100%"
|
||||||
|
height="100%" />
|
||||||
|
</g>
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:#464646;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="circle-3"
|
||||||
|
d="m 581.65725,30 c 0,6.078 -4.926,11 -11,11 -6.074,0 -11,-4.922 -11,-11 0,-6.074 4.926,-11 11,-11 6.074,0 11,4.926 11,11 z"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 5.4 KiB |
313
worldmap/leaflet/leaflet.draw.css
vendored
@ -1,303 +1,10 @@
|
|||||||
/* ================================================================== */
|
.leaflet-draw-section{position:relative}.leaflet-draw-toolbar{margin-top:12px}.leaflet-draw-toolbar-top{margin-top:0}.leaflet-draw-toolbar-notop a:first-child{border-top-right-radius:0}.leaflet-draw-toolbar-nobottom a:last-child{border-bottom-right-radius:0}.leaflet-draw-toolbar a{background-image:url('images/spritesheet.png');background-image:linear-gradient(transparent,transparent),url('images/spritesheet.svg');background-repeat:no-repeat;background-size:300px 30px;background-clip:padding-box}.leaflet-retina .leaflet-draw-toolbar a{background-image:url('images/spritesheet-2x.png');background-image:linear-gradient(transparent,transparent),url('images/spritesheet.svg')}
|
||||||
/* Toolbars
|
.leaflet-draw a{display:block;text-align:center;text-decoration:none}.leaflet-draw a .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.leaflet-draw-actions{display:none;list-style:none;margin:0;padding:0;position:absolute;left:26px;top:0;white-space:nowrap}.leaflet-touch .leaflet-draw-actions{left:32px}.leaflet-right .leaflet-draw-actions{right:26px;left:auto}.leaflet-touch .leaflet-right .leaflet-draw-actions{right:32px;left:auto}.leaflet-draw-actions li{display:inline-block}
|
||||||
/* ================================================================== */
|
.leaflet-draw-actions li:first-child a{border-left:0}.leaflet-draw-actions li:last-child a{-webkit-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.leaflet-right .leaflet-draw-actions li:last-child a{-webkit-border-radius:0;border-radius:0}.leaflet-right .leaflet-draw-actions li:first-child a{-webkit-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.leaflet-draw-actions a{background-color:#919187;border-left:1px solid #AAA;color:#FFF;font:11px/19px "Helvetica Neue",Arial,Helvetica,sans-serif;line-height:28px;text-decoration:none;padding-left:10px;padding-right:10px;height:28px}
|
||||||
|
.leaflet-touch .leaflet-draw-actions a{font-size:12px;line-height:30px;height:30px}.leaflet-draw-actions-bottom{margin-top:0}.leaflet-draw-actions-top{margin-top:1px}.leaflet-draw-actions-top a,.leaflet-draw-actions-bottom a{height:27px;line-height:27px}.leaflet-draw-actions a:hover{background-color:#a0a098}.leaflet-draw-actions-top.leaflet-draw-actions-bottom a{height:26px;line-height:26px}.leaflet-draw-toolbar .leaflet-draw-draw-polyline{background-position:-2px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polyline{background-position:0 -1px}
|
||||||
.leaflet-draw-section {
|
.leaflet-draw-toolbar .leaflet-draw-draw-polygon{background-position:-31px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polygon{background-position:-29px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-rectangle{background-position:-62px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-rectangle{background-position:-60px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-circle{background-position:-92px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circle{background-position:-90px -1px}
|
||||||
position: relative;
|
.leaflet-draw-toolbar .leaflet-draw-draw-marker{background-position:-122px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-marker{background-position:-120px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-circlemarker{background-position:-273px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circlemarker{background-position:-271px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-edit{background-position:-152px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit{background-position:-150px -1px}
|
||||||
}
|
.leaflet-draw-toolbar .leaflet-draw-edit-remove{background-position:-182px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove{background-position:-180px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled{background-position:-212px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled{background-position:-210px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled{background-position:-242px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled{background-position:-240px -2px}
|
||||||
|
.leaflet-mouse-marker{background-color:#fff;cursor:crosshair}.leaflet-draw-tooltip{background:#363636;background:rgba(0,0,0,0.5);border:1px solid transparent;-webkit-border-radius:4px;border-radius:4px;color:#fff;font:12px/18px "Helvetica Neue",Arial,Helvetica,sans-serif;margin-left:20px;margin-top:-21px;padding:4px 8px;position:absolute;visibility:hidden;white-space:nowrap;z-index:6}.leaflet-draw-tooltip:before{border-right:6px solid black;border-right-color:rgba(0,0,0,0.5);border-top:6px solid transparent;border-bottom:6px solid transparent;content:"";position:absolute;top:7px;left:-7px}
|
||||||
.leaflet-draw-toolbar {
|
.leaflet-error-draw-tooltip{background-color:#f2dede;border:1px solid #e6b6bd;color:#b94a48}.leaflet-error-draw-tooltip:before{border-right-color:#e6b6bd}.leaflet-draw-tooltip-single{margin-top:-12px}.leaflet-draw-tooltip-subtext{color:#f8d5e4}.leaflet-draw-guide-dash{font-size:1%;opacity:.6;position:absolute;width:5px;height:5px}.leaflet-edit-marker-selected{background-color:rgba(254,87,161,0.1);border:4px dashed rgba(254,87,161,0.6);-webkit-border-radius:4px;border-radius:4px;box-sizing:content-box}
|
||||||
margin-top: 12px;
|
.leaflet-edit-move{cursor:move}.leaflet-edit-resize{cursor:pointer}.leaflet-oldie .leaflet-draw-toolbar{border:1px solid #999}
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar-top {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar-notop a:first-child {
|
|
||||||
border-top-right-radius: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar-nobottom a:last-child {
|
|
||||||
border-bottom-right-radius: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar a {
|
|
||||||
background-image: url('images/spritesheet.png');
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-retina .leaflet-draw-toolbar a {
|
|
||||||
background-image: url('images/spritesheet-2x.png');
|
|
||||||
background-size: 270px 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw a {
|
|
||||||
display: block;
|
|
||||||
text-align: center;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================================================================== */
|
|
||||||
/* Toolbar actions menu
|
|
||||||
/* ================================================================== */
|
|
||||||
|
|
||||||
.leaflet-draw-actions {
|
|
||||||
display: none;
|
|
||||||
list-style: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
position: absolute;
|
|
||||||
left: 26px; /* leaflet-draw-toolbar.left + leaflet-draw-toolbar.width */
|
|
||||||
top: 0;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-touch .leaflet-draw-actions {
|
|
||||||
left: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-right .leaflet-draw-actions {
|
|
||||||
right:26px;
|
|
||||||
left:auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-touch .leaflet-right .leaflet-draw-actions {
|
|
||||||
right:32px;
|
|
||||||
left:auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-actions li {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-actions li:first-child a {
|
|
||||||
border-left: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-actions li:last-child a {
|
|
||||||
-webkit-border-radius: 0 4px 4px 0;
|
|
||||||
border-radius: 0 4px 4px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-right .leaflet-draw-actions li:last-child a {
|
|
||||||
-webkit-border-radius: 0;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-right .leaflet-draw-actions li:first-child a {
|
|
||||||
-webkit-border-radius: 4px 0 0 4px;
|
|
||||||
border-radius: 4px 0 0 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-actions a {
|
|
||||||
background-color: #919187;
|
|
||||||
border-left: 1px solid #AAA;
|
|
||||||
color: #FFF;
|
|
||||||
font: 11px/19px "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
||||||
line-height: 28px;
|
|
||||||
text-decoration: none;
|
|
||||||
padding-left: 10px;
|
|
||||||
padding-right: 10px;
|
|
||||||
height: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-touch .leaflet-draw-actions a {
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 30px;
|
|
||||||
height: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-actions-bottom {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-actions-top {
|
|
||||||
margin-top: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-actions-top a,
|
|
||||||
.leaflet-draw-actions-bottom a {
|
|
||||||
height: 27px;
|
|
||||||
line-height: 27px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-actions a:hover {
|
|
||||||
background-color: #A0A098;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-actions-top.leaflet-draw-actions-bottom a {
|
|
||||||
height: 26px;
|
|
||||||
line-height: 26px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================================================================== */
|
|
||||||
/* Draw toolbar
|
|
||||||
/* ================================================================== */
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar .leaflet-draw-draw-polyline {
|
|
||||||
background-position: -2px -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polyline {
|
|
||||||
background-position: 0 -1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar .leaflet-draw-draw-polygon {
|
|
||||||
background-position: -31px -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polygon {
|
|
||||||
background-position: -29px -1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar .leaflet-draw-draw-rectangle {
|
|
||||||
background-position: -62px -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-rectangle {
|
|
||||||
background-position: -60px -1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar .leaflet-draw-draw-circle {
|
|
||||||
background-position: -92px -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circle {
|
|
||||||
background-position: -90px -1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar .leaflet-draw-draw-marker {
|
|
||||||
background-position: -122px -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-marker {
|
|
||||||
background-position: -120px -1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================================================================== */
|
|
||||||
/* Edit toolbar
|
|
||||||
/* ================================================================== */
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar .leaflet-draw-edit-edit {
|
|
||||||
background-position: -152px -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit {
|
|
||||||
background-position: -150px -1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar .leaflet-draw-edit-remove {
|
|
||||||
background-position: -182px -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove {
|
|
||||||
background-position: -180px -1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled {
|
|
||||||
background-position: -212px -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled {
|
|
||||||
background-position: -210px -1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled {
|
|
||||||
background-position: -242px -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled {
|
|
||||||
background-position: -240px -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================================================================== */
|
|
||||||
/* Drawing styles
|
|
||||||
/* ================================================================== */
|
|
||||||
|
|
||||||
.leaflet-mouse-marker {
|
|
||||||
background-color: #fff;
|
|
||||||
cursor: crosshair;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-tooltip {
|
|
||||||
background: rgb(54, 54, 54);
|
|
||||||
background: rgba(0, 0, 0, 0.5);
|
|
||||||
border: 1px solid transparent;
|
|
||||||
-webkit-border-radius: 4px;
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #fff;
|
|
||||||
font: 12px/18px "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
||||||
margin-left: 20px;
|
|
||||||
margin-top: -21px;
|
|
||||||
padding: 4px 8px;
|
|
||||||
position: absolute;
|
|
||||||
visibility: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
z-index: 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-tooltip:before {
|
|
||||||
border-right: 6px solid black;
|
|
||||||
border-right-color: rgba(0, 0, 0, 0.5);
|
|
||||||
border-top: 6px solid transparent;
|
|
||||||
border-bottom: 6px solid transparent;
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
top: 7px;
|
|
||||||
left: -7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-error-draw-tooltip {
|
|
||||||
background-color: #F2DEDE;
|
|
||||||
border: 1px solid #E6B6BD;
|
|
||||||
color: #B94A48;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-error-draw-tooltip:before {
|
|
||||||
border-right-color: #E6B6BD;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-tooltip-single {
|
|
||||||
margin-top: -12px
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-tooltip-subtext {
|
|
||||||
color: #f8d5e4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-draw-guide-dash {
|
|
||||||
font-size: 1%;
|
|
||||||
opacity: 0.6;
|
|
||||||
position: absolute;
|
|
||||||
width: 5px;
|
|
||||||
height: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================================================================== */
|
|
||||||
/* Edit styles
|
|
||||||
/* ================================================================== */
|
|
||||||
|
|
||||||
.leaflet-edit-marker-selected {
|
|
||||||
background: rgba(254, 87, 161, 0.1);
|
|
||||||
border: 4px dashed rgba(254, 87, 161, 0.6);
|
|
||||||
-webkit-border-radius: 4px;
|
|
||||||
border-radius: 4px;
|
|
||||||
box-sizing: content-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-edit-move {
|
|
||||||
cursor: move;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-edit-resize {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================================================================== */
|
|
||||||
/* Old IE styles
|
|
||||||
/* ================================================================== */
|
|
||||||
|
|
||||||
.leaflet-oldie .leaflet-draw-toolbar {
|
|
||||||
border: 1px solid #999;
|
|
||||||
}
|
|