@ -259,6 +259,37 @@ class NodeBase {
updateBoundingBox ( x , y , ctx , selected , hover ) {
updateBoundingBox ( x , y , ctx , selected , hover ) {
this . _updateBoundingBox ( x , y , ctx , selected , hover ) ;
this . _updateBoundingBox ( x , y , ctx , selected , hover ) ;
}
}
/ * *
* Determine the dimensions to use for nodes with an internal label
*
* Currently , these are : Circle , Ellipse , Database , Box
* The other nodes have external labels , and will not call this method
*
* If there is no label , decent default values are supplied .
*
* @ param { CanvasRenderingContext2D } ctx
* @ param { boolean } [ selected ]
* @ param { boolean } [ hover ]
* @ returns { { width : number , height : number } }
* /
getDimensionsFromLabel ( ctx , selected , hover ) {
// NOTE: previously 'textSize' was not put in 'this' for Ellipse
// TODO: examine the consequences.
this . textSize = this . labelModule . getTextSize ( ctx , selected , hover ) ;
var width = this . textSize . width ;
var height = this . textSize . height ;
const DEFAULT_SIZE = 14 ;
if ( width === 0 ) {
// This happens when there is no label text set
width = DEFAULT_SIZE ; // use a decent default
height = DEFAULT_SIZE ; // if width zero, then height also always zero
}
return { width : width , height : height } ;
}
}
}
export default NodeBase ;
export default NodeBase ;