Skip to content

Commit

Permalink
Correct calculation of compound label size iVis-at-Bilkent/layout-base#8
Browse files Browse the repository at this point in the history
  • Loading branch information
hasanbalci committed Dec 16, 2020
1 parent 90b6d30 commit 0a9b8ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 4 additions & 6 deletions cytoscape-fcose.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,12 +731,10 @@ var coseLayout = function coseLayout(options, spectralResult) {
//Attach the label properties to compound if labels will be included in node dimensions
if (options.nodeDimensionsIncludeLabels) {
if (theChild.isParent()) {
var labelWidth = theChild.boundingBox({ includeLabels: true, includeNodes: false }).w;
var labelHeight = theChild.boundingBox({ includeLabels: true, includeNodes: false }).h;
var labelPos = theChild.css("text-valign");
theNode.labelWidth = labelWidth;
theNode.labelHeight = labelHeight;
theNode.labelPos = labelPos;
theNode.labelWidth = theChild.boundingBox({ includeLabels: true, includeNodes: false, includeOverlays: false }).w;
theNode.labelHeight = theChild.boundingBox({ includeLabels: true, includeNodes: false, includeOverlays: false }).h;
theNode.labelPosVertical = theChild.css("text-valign");
theNode.labelPosHorizontal = theChild.css("text-halign");
}
}

Expand Down
10 changes: 4 additions & 6 deletions src/fcose/cose.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ let coseLayout = function(options, spectralResult){
//Attach the label properties to compound if labels will be included in node dimensions
if(options.nodeDimensionsIncludeLabels){
if(theChild.isParent()){
let labelWidth = theChild.boundingBox({ includeLabels: true, includeNodes: false }).w;
let labelHeight = theChild.boundingBox({ includeLabels: true, includeNodes: false }).h;
let labelPos = theChild.css("text-valign");
theNode.labelWidth = labelWidth;
theNode.labelHeight = labelHeight;
theNode.labelPos = labelPos;
theNode.labelWidth = theChild.boundingBox({ includeLabels: true, includeNodes: false, includeOverlays: false }).w;
theNode.labelHeight = theChild.boundingBox({ includeLabels: true, includeNodes: false, includeOverlays: false }).h;
theNode.labelPosVertical = theChild.css("text-valign");
theNode.labelPosHorizontal = theChild.css("text-halign");
}
}

Expand Down

0 comments on commit 0a9b8ff

Please sign in to comment.