()
| 339 | } |
| 340 | |
| 341 | function createLineDragHandles() { |
| 342 | var minSensoryWidth = 10; |
| 343 | var sensoryWidth = Math.max(shapeOptions.line.width, minSensoryWidth); |
| 344 | |
| 345 | // Helper shapes group |
| 346 | // Note that by setting the `data-index` attr, it is ensured that |
| 347 | // the helper group is purged in this modules `draw` function |
| 348 | var g = shapeLayer.append('g').attr('data-index', index).attr('drag-helper', true); |
| 349 | |
| 350 | // Helper path for moving |
| 351 | g.append('path').attr('d', shapePath.attr('d')).style({ |
| 352 | cursor: 'move', |
| 353 | 'stroke-width': sensoryWidth, |
| 354 | 'stroke-opacity': '0' // ensure not visible |
| 355 | }); |
| 356 | |
| 357 | // Helper circles for resizing |
| 358 | var circleStyle = { |
| 359 | 'fill-opacity': '0' // ensure not visible |
| 360 | }; |
| 361 | var circleRadius = Math.max(sensoryWidth / 2, minSensoryWidth); |
| 362 | |
| 363 | g.append('circle') |
| 364 | .attr({ |
| 365 | 'data-line-point': 'start-point', |
| 366 | cx: xPixelSized ? x2p(shapeOptions.xanchor) + shapeOptions.x0 : x2p(shapeOptions.x0, shiftXStart), |
| 367 | cy: yPixelSized ? y2p(shapeOptions.yanchor) - shapeOptions.y0 : y2p(shapeOptions.y0, shiftYStart), |
| 368 | r: circleRadius |
| 369 | }) |
| 370 | .style(circleStyle) |
| 371 | .classed('cursor-grab', true); |
| 372 | |
| 373 | g.append('circle') |
| 374 | .attr({ |
| 375 | 'data-line-point': 'end-point', |
| 376 | cx: xPixelSized ? x2p(shapeOptions.xanchor) + shapeOptions.x1 : x2p(shapeOptions.x1, shiftXEnd), |
| 377 | cy: yPixelSized ? y2p(shapeOptions.yanchor) - shapeOptions.y1 : y2p(shapeOptions.y1, shiftYEnd), |
| 378 | r: circleRadius |
| 379 | }) |
| 380 | .style(circleStyle) |
| 381 | .classed('cursor-grab', true); |
| 382 | |
| 383 | return g; |
| 384 | } |
| 385 | |
| 386 | function updateDragMode(evt) { |
| 387 | if (shouldSkipEdits(gd)) { |
no test coverage detected
searching dependent graphs…