@ -28425,7 +28425,6 @@ return /******/ (function(modules) { // webpackBootstrap
var threshold = 0.2 ;
var threshold = 0.2 ;
var node = this . to ;
var node = this . to ;
if ( from == true ) {
if ( from == true ) {
node = this . from ;
node = this . from ;
}
}
@ -28708,26 +28707,30 @@ return /******/ (function(modules) { // webpackBootstrap
var nodeIdFrom = "edgeIdFrom:" . concat ( this . id ) ;
var nodeIdFrom = "edgeIdFrom:" . concat ( this . id ) ;
var nodeIdTo = "edgeIdTo:" . concat ( this . id ) ;
var nodeIdTo = "edgeIdTo:" . concat ( this . id ) ;
var constants = {
var constants = {
nodes : { group : '' , radius : 8 } ,
nodes : { group : '' , radius : 7 , borderWidth : 2 , borderWidthSelected : 2 } ,
physics : { damping : 0 } ,
physics : { damping : 0 } ,
clustering : { maxNodeSizeIncrements : 0 , nodeScaling : { width : 0 , height : 0 , radius : 0 } }
clustering : { maxNodeSizeIncrements : 0 , nodeScaling : { width : 0 , height : 0 , radius : 0 } }
} ;
} ;
this . controlNodes . from = new Node (
this . controlNodes . from = new Node (
{ id : nodeIdFrom ,
{ id : nodeIdFrom ,
shape : 'dot' ,
shape : 'dot' ,
color : { background : '#ff4e 00' , border : '#3c3c3c' , highlight : { background : '#07f968' } }
color : { background : '#ff00 00' , border : '#3c3c3c' , highlight : { background : '#07f968' } }
} , { } , { } , constants ) ;
} , { } , { } , constants ) ;
this . controlNodes . to = new Node (
this . controlNodes . to = new Node (
{ id : nodeIdTo ,
{ id : nodeIdTo ,
shape : 'dot' ,
shape : 'dot' ,
color : { background : '#ff4e 00' , border : '#3c3c3c' , highlight : { background : '#07f968' } }
color : { background : '#ff00 00' , border : '#3c3c3c' , highlight : { background : '#07f968' } }
} , { } , { } , constants ) ;
} , { } , { } , constants ) ;
}
}
if ( this . controlNodes . from . selected == false && this . controlNodes . to . selected == false ) {
this . controlNodes . positions = this . getControlNodePositions ( ctx ) ;
this . controlNodes . positions = { } ;
if ( this . controlNodes . from . selected == false ) {
this . controlNodes . positions . from = this . getControlNodeFromPosition ( ctx ) ;
this . controlNodes . from . x = this . controlNodes . positions . from . x ;
this . controlNodes . from . x = this . controlNodes . positions . from . x ;
this . controlNodes . from . y = this . controlNodes . positions . from . y ;
this . controlNodes . from . y = this . controlNodes . positions . from . y ;
}
if ( this . controlNodes . to . selected == false ) {
this . controlNodes . positions . to = this . getControlNodeToPosition ( ctx ) ;
this . controlNodes . to . x = this . controlNodes . positions . to . x ;
this . controlNodes . to . x = this . controlNodes . positions . to . x ;
this . controlNodes . to . y = this . controlNodes . positions . to . y ;
this . controlNodes . to . y = this . controlNodes . positions . to . y ;
}
}
@ -28819,46 +28822,56 @@ return /******/ (function(modules) { // webpackBootstrap
* this calculates the position of the control nodes on the edges of the parent nodes .
* this calculates the position of the control nodes on the edges of the parent nodes .
*
*
* @ param ctx
* @ param ctx
* @ returns { { from : { x : number , y : number } , to : { x : * , y : * } } }
* @ returns { x : * , y : * }
* /
* /
Edge . prototype . getControlNodePositions = function ( ctx ) {
var angle = Math . atan2 ( ( this . to . y - this . from . y ) , ( this . to . x - this . from . x ) ) ;
var dx = ( this . to . x - this . from . x ) ;
var dy = ( this . to . y - this . from . y ) ;
var edgeSegmentLength = Math . sqrt ( dx * dx + dy * dy ) ;
var fromBorderDist = this . from . distanceToBorder ( ctx , angle + Math . PI ) ;
var fromBorderPoint = ( edgeSegmentLength - fromBorderDist ) / edgeSegmentLength ;
var xFrom = ( fromBorderPoint ) * this . from . x + ( 1 - fromBorderPoint ) * this . to . x ;
var yFrom = ( fromBorderPoint ) * this . from . y + ( 1 - fromBorderPoint ) * this . to . y ;
var via ;
if ( this . options . smoothCurves . dynamic == true && this . options . smoothCurves . enabled == true ) {
via = this . via ;
}
else if ( this . options . smoothCurves . enabled == true ) {
via = this . _getViaCoordinates ( ) ;
Edge . prototype . getControlNodeFromPosition = function ( ctx ) {
// draw arrow head
var controlnodeFromPos ;
if ( this . options . smoothCurves . enabled == true ) {
controlnodeFromPos = this . _findBorderPosition ( true , ctx ) ;
}
}
else {
var angle = Math . atan2 ( ( this . to . y - this . from . y ) , ( this . to . x - this . from . x ) ) ;
var dx = ( this . to . x - this . from . x ) ;
var dy = ( this . to . y - this . from . y ) ;
var edgeSegmentLength = Math . sqrt ( dx * dx + dy * dy ) ;
if ( this . options . smoothCurves . enabled == true && via . x != null ) {
angle = Math . atan2 ( ( this . to . y - via . y ) , ( this . to . x - via . x ) ) ;
dx = ( this . to . x - via . x ) ;
dy = ( this . to . y - via . y ) ;
edgeSegmentLength = Math . sqrt ( dx * dx + dy * dy ) ;
var fromBorderDist = this . from . distanceToBorder ( ctx , angle + Math . PI ) ;
var fromBorderPoint = ( edgeSegmentLength - fromBorderDist ) / edgeSegmentLength ;
controlnodeFromPos = { } ;
controlnodeFromPos . x = ( fromBorderPoint ) * this . from . x + ( 1 - fromBorderPoint ) * this . to . x ;
controlnodeFromPos . y = ( fromBorderPoint ) * this . from . y + ( 1 - fromBorderPoint ) * this . to . y ;
}
}
var toBorderDist = this . to . distanceToBorder ( ctx , angle ) ;
var toBorderPoint = ( edgeSegmentLength - toBorderDist ) / edgeSegmentLength ;
var xTo , yTo ;
if ( this . options . smoothCurves . enabled == true && via . x != null ) {
xTo = ( 1 - toBorderPoint ) * via . x + toBorderPoint * this . to . x ;
yTo = ( 1 - toBorderPoint ) * via . y + toBorderPoint * this . to . y ;
return controlnodeFromPos ;
} ;
/ * *
* this calculates the position of the control nodes on the edges of the parent nodes .
*
* @ param ctx
* @ returns { { from : { x : number , y : number } , to : { x : * , y : * } } }
* /
Edge . prototype . getControlNodeToPosition = function ( ctx ) {
// draw arrow head
var controlnodeFromPos , controlnodeToPos ;
if ( this . options . smoothCurves . enabled == true ) {
controlnodeToPos = this . _findBorderPosition ( false , ctx ) ;
}
}
else {
else {
xTo = ( 1 - toBorderPoint ) * this . from . x + toBorderPoint * this . to . x ;
yTo = ( 1 - toBorderPoint ) * this . from . y + toBorderPoint * this . to . y ;
var angle = Math . atan2 ( ( this . to . y - this . from . y ) , ( this . to . x - this . from . x ) ) ;
var dx = ( this . to . x - this . from . x ) ;
var dy = ( this . to . y - this . from . y ) ;
var edgeSegmentLength = Math . sqrt ( dx * dx + dy * dy ) ;
var toBorderDist = this . to . distanceToBorder ( ctx , angle ) ;
var toBorderPoint = ( edgeSegmentLength - toBorderDist ) / edgeSegmentLength ;
controlnodeToPos = { } ;
controlnodeToPos . x = ( 1 - toBorderPoint ) * this . from . x + toBorderPoint * this . to . x ;
controlnodeToPos . y = ( 1 - toBorderPoint ) * this . from . y + toBorderPoint * this . to . y ;
}
}
return { from : { x : xFrom , y : yFrom } , to : { x : xTo , y : yTo } } ;
return controlnodeToPos ;
} ;
} ;
module . exports = Edge ;
module . exports = Edge ;
@ -33393,14 +33406,22 @@ return /******/ (function(modules) { // webpackBootstrap
this . _redraw ( ) ;
this . _redraw ( ) ;
} ;
} ;
/ * *
*
* @ param pointer
* @ private
* /
exports . _releaseControlNode = function ( pointer ) {
exports . _releaseControlNode = function ( pointer ) {
var newNode = this . _getNodeAt ( pointer ) ;
var newNode = this . _getNodeAt ( pointer ) ;
if ( newNode !== null ) {
if ( newNode !== null ) {
if ( this . edgeBeingEdited . controlNodes . from . selected == true ) {
if ( this . edgeBeingEdited . controlNodes . from . selected == true ) {
this . edgeBeingEdited . _restoreControlNodes ( ) ;
this . _editEdge ( newNode . id , this . edgeBeingEdited . to . id ) ;
this . _editEdge ( newNode . id , this . edgeBeingEdited . to . id ) ;
this . edgeBeingEdited . controlNodes . from . unselect ( ) ;
this . edgeBeingEdited . controlNodes . from . unselect ( ) ;
}
}
if ( this . edgeBeingEdited . controlNodes . to . selected == true ) {
if ( this . edgeBeingEdited . controlNodes . to . selected == true ) {
this . edgeBeingEdited . _restoreControlNodes ( ) ;
this . _editEdge ( this . edgeBeingEdited . from . id , newNode . id ) ;
this . _editEdge ( this . edgeBeingEdited . from . id , newNode . id ) ;
this . edgeBeingEdited . controlNodes . to . unselect ( ) ;
this . edgeBeingEdited . controlNodes . to . unselect ( ) ;
}
}