Every line of 'd3.mouse(this)' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
262 .x(function x(d) { return d.x; })
61 mousedown(d3obj, d) {}
13 onMouseUp() { 14 this.svg.selectAll('.selection').remove(); 15 // Enable again the default browser text selection. 16 // Disabled this because is was causing problems with text higlhlighting 17 // $('body').css({ 18 // 'user-select': 'all' 19 // }); 20 }
57 function mouseup(d) { 58 if (mousedown_node) { 59 drag_line 60 .classed('hidden', true) 61 .style('marker-end', ''); 62 } 63 // because :active only works in WebKit? 64 svg.classed('active', false); 65 // clear mouse event vars 66 resetMouseVars(); 67 }
260 function dragged(d) { 261 d.type.update(d3Selection.select(this), d); 262 }
74 function mouse_down_event(d, i) { 75 var p = d3.mouse(this); 76 var di = Math.ceil(x.invert(p[0]))-1; 77 if (allow_selection) { 78 mouse_down_start = di; 79 mouse_down_end = di; 80 start_time_selection(di); 81 } 82 }
90 function dragged(d) { 91 d.fx = d3.event.x; 92 d.fy = d3.event.y; 93 }
100 function click() { 101 d3_select(window) 102 .on('mouseup.select', null, true); 103 104 if (!_p1) return; 105 var p2 = point(); 106 var dist = geoVecLength(_p1, p2); 107 _p1 = null; 108 if (dist > tolerance) return; 109 110 // Defer processing the click, 111 // because this click may trigger a blur event, 112 // and the blur event may trigger a tag change, 113 // and we really want that tag change to go to the already selected entity 114 // and not the one that we are about to select with the click #6028, #5878 115 // (Be very careful entering modeSelect anywhere that might also blur a field!) 116 var datum = d3_event.target.__data__ || (_lastMouse && _lastMouse.target.__data__); 117 var isMultiselect = d3_event.shiftKey || d3_select('#surface .lasso').node(); 118 window.setTimeout(function() { 119 processClick(datum, isMultiselect); 120 }, 20); // delay > whatever raw_tag_editor.js `scheduleChange` does (10ms). 121 }
330 function click(d) { 331 if (!d.children) { 332 if (d.parent) { 333 // Clicking on the rightmost level should zoom in 334 return click(d.parent); 335 } 336 337 return false; 338 } 339 zoomX = (d.y ? w - 40 : w) / (1 - d.y); 340 zoomY = h / d.dx; 341 x.domain([d.y, 1]).range([d.y ? 40 : 0, w]); 342 y.domain([d.x, d.x + d.dx]); 343 344 const t = g 345 .transition() 346 .duration(d3.event.altKey ? 7500 : 750) 347 .attr('transform', nd => `translate(${x(nd.y)},${y(nd.x)})`); 348 349 t.select('rect') 350 .attr('width', d.dy * zoomX) 351 .attr('height', nd => nd.dx * zoomY); 352 353 t.select('text') 354 .attr('transform', transform) 355 .style('opacity', nd => (nd.dx * zoomY > 12 ? 1 : 0)); 356 357 d3.event.stopPropagation(); 358 359 return true; 360 }
334 function click(d) { 335 if (!d.children) { 336 if (d.parent) { 337 // Clicking on the rightmost level should zoom in 338 return click(d.parent); 339 } 340 return false; 341 } 342 zoomX = (d.y ? w - 40 : w) / (1 - d.y); 343 zoomY = h / d.dx; 344 x.domain([d.y, 1]).range([d.y ? 40 : 0, w]); 345 y.domain([d.x, d.x + d.dx]); 346 347 const t = g 348 .transition() 349 .duration(d3.event.altKey ? 7500 : 750) 350 .attr('transform', nd => `translate(${x(nd.y)},${y(nd.x)})`); 351 352 t.select('rect') 353 .attr('width', d.dy * zoomX) 354 .attr('height', nd => nd.dx * zoomY); 355 356 t.select('text') 357 .attr('transform', transform) 358 .style('opacity', nd => nd.dx * zoomY > 12 ? 1 : 0); 359 360 d3.event.stopPropagation(); 361 return true; 362 }