cytoscape-cxtmenu
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -125,5 +125,15 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
zIndex: options.zIndex, | ||
userSelect: 'none' | ||
userSelect: 'none', | ||
pointerEvents: 'none' // prevent events on menu in modern browsers | ||
}); | ||
// prevent events on menu in legacy browsers | ||
['mousedown', 'mousemove', 'mouseup', 'contextmenu'].forEach(function (evt) { | ||
wrapper.addEventListener(evt, function (e) { | ||
e.preventDefault(); | ||
return false; | ||
}); | ||
}); | ||
setStyles(parent, { | ||
@@ -192,3 +202,3 @@ display: 'none', | ||
if (command.disabled === true || command.enabled === false) { | ||
content.classList.add('cxtmenu-disabled'); | ||
content.setAttribute('class', 'cxtmenu-content cxtmenu-disabled'); | ||
} | ||
@@ -322,4 +332,4 @@ | ||
var pxr = getPixelRatio(); | ||
var w = container.clientWidth; | ||
var h = container.clientHeight; | ||
var w = containerSize; | ||
var h = containerSize; | ||
@@ -338,3 +348,7 @@ canvas.width = w * pxr; | ||
var redrawQueue = {}; | ||
var raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame; | ||
var raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || function (fn) { | ||
return setTimeout(fn, 16); | ||
}; | ||
var redraw = function redraw() { | ||
@@ -639,3 +653,5 @@ if (redrawQueue.drawBg) { | ||
srcs.forEach(function (src) { | ||
srcs.filter(function (src) { | ||
return src != null; | ||
}).forEach(function (src) { | ||
Object.keys(src).forEach(function (k) { | ||
@@ -699,5 +715,9 @@ return tgt[k] = src[k]; | ||
ancestor.querySelectorAll(query).forEach(function (el) { | ||
return el.parentNode.removeChild(el); | ||
}); | ||
var els = ancestor.querySelectorAll(query); | ||
for (var i = 0; i < els.length; i++) { | ||
var el = els[i]; | ||
el.parentNode.removeChild(el); | ||
} | ||
}; | ||
@@ -704,0 +724,0 @@ |
{ | ||
"name": "cytoscape-cxtmenu", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "A circular, swipeable context menu extension for Cytoscape.js", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-cxtmenu.js", |
// Simple, internal Object.assign() polyfill for options objects etc. | ||
module.exports = Object.assign != null ? Object.assign.bind( Object ) : function( tgt, ...srcs ){ | ||
srcs.forEach( src => { | ||
srcs.filter(src => src != null).forEach( src => { | ||
Object.keys( src ).forEach( k => tgt[k] = src[k] ); | ||
@@ -6,0 +6,0 @@ } ); |
@@ -34,5 +34,15 @@ const defaults = require('./defaults'); | ||
zIndex: options.zIndex, | ||
userSelect: 'none' | ||
userSelect: 'none', | ||
pointerEvents: 'none' // prevent events on menu in modern browsers | ||
}); | ||
// prevent events on menu in legacy browsers | ||
['mousedown', 'mousemove', 'mouseup', 'contextmenu'].forEach(evt => { | ||
wrapper.addEventListener(evt, e => { | ||
e.preventDefault(); | ||
return false; | ||
}); | ||
}); | ||
setStyles(parent, { | ||
@@ -101,3 +111,3 @@ display: 'none', | ||
if (command.disabled === true || command.enabled === false) { | ||
content.classList.add('cxtmenu-disabled'); | ||
content.setAttribute('class', 'cxtmenu-content cxtmenu-disabled'); | ||
} | ||
@@ -232,4 +242,4 @@ | ||
let pxr = getPixelRatio(); | ||
let w = container.clientWidth; | ||
let h = container.clientHeight; | ||
let w = containerSize; | ||
let h = containerSize; | ||
@@ -248,3 +258,11 @@ canvas.width = w * pxr; | ||
let redrawQueue = {}; | ||
let raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame; | ||
let raf = ( | ||
window.requestAnimationFrame | ||
|| window.webkitRequestAnimationFrame | ||
|| window.mozRequestAnimationFrame | ||
|| window.msRequestAnimationFrame | ||
|| (fn => setTimeout(fn, 16)) | ||
); | ||
let redraw = function(){ | ||
@@ -251,0 +269,0 @@ if( redrawQueue.drawBg ){ |
const removeEles = function(query, ancestor = document) { | ||
ancestor.querySelectorAll(query).forEach( el => el.parentNode.removeChild(el) ); | ||
let els = ancestor.querySelectorAll(query); | ||
for( let i = 0; i < els.length; i++ ){ | ||
let el = els[i]; | ||
el.parentNode.removeChild(el); | ||
} | ||
}; | ||
@@ -4,0 +10,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82484
1187