@@ -323,7 +323,7 @@ _.forEach(align,function(v){xs[v]=xs[root[v]]});return xs}function buildBlockGra
323
323
* the minimum coordinate of the smallest width alignment and right-biased
324
324
* alignments have their maximum coordinate at the same point as the maximum
325
325
* coordinate of the smallest width alignment.
326
- */ function alignCoordinates ( xss , alignTo ) { var alignToVals = _ . values ( alignTo ) , alignToMin = _ . min ( alignToVals ) , alignToMax = _ . max ( alignToVals ) ; _ . forEach ( [ "u" , "d" ] , function ( vert ) { _ . forEach ( [ "l" , "r" ] , function ( horiz ) { var alignment = vert + horiz , xs = xss [ alignment ] , delta ; if ( xs === alignTo ) return ; var xsVals = _ . values ( xs ) ; delta = horiz === "l" ?alignToMin - _ . min ( xsVals ) :alignToMax - _ . max ( xsVals ) ; if ( delta ) { xss [ alignment ] = _ . mapValues ( xs , function ( x ) { return x + delta } ) } } ) } ) } function balance ( xss , align ) { return _ . mapValues ( xss . ul , function ( ignore , v ) { if ( align ) { return xss [ align . toLowerCase ( ) ] [ v ] } else { var xs = _ . sortBy ( _ . map ( xss , v ) ) ; return ( xs [ 1 ] + xs [ 2 ] ) / 2 } } ) } function positionX ( g ) { var layering = util . buildLayerMatrix ( g ) ; var conflicts = _ . merge ( findType1Conflicts ( g , layering ) , findType2Conflicts ( g , layering ) ) ; var xss = { } ; var adjustedLayering ; _ . forEach ( [ "u" , "d" ] , function ( vert ) { adjustedLayering = vert === "u" ?layering :_ . values ( layering ) . reverse ( ) ; _ . forEach ( [ "l" , "r" ] , function ( horiz ) { if ( horiz === "r" ) { adjustedLayering = _ . map ( adjustedLayering , function ( inner ) { return _ . values ( inner ) . reverse ( ) } ) } var neighborFn = ( vert === "u" ?g . predecessors :g . successors ) . bind ( g ) ; var align = verticalAlignment ( g , adjustedLayering , conflicts , neighborFn ) ; var xs = horizontalCompaction ( g , adjustedLayering , align . root , align . align , horiz === "r" ) ; if ( horiz === "r" ) { xs = _ . mapValues ( xs , function ( x ) { return - x } ) } xss [ vert + horiz ] = xs } ) } ) ; var smallestWidth = findSmallestWidthAlignment ( g , xss ) ; alignCoordinates ( xss , smallestWidth ) ; return balance ( xss , g . graph ( ) . align ) } function sep ( nodeSep , edgeSep , reverseSep ) { return function ( g , v , w ) { var vLabel = g . node ( v ) ; var wLabel = g . node ( w ) ; var sum = 0 ; var delta ; sum += vLabel . width / 2 ; if ( _ . has ( vLabel , "labelpos" ) ) { switch ( vLabel . labelpos . toLowerCase ( ) ) { case "l" :delta = - vLabel . width / 2 ; break ; case "r" :delta = vLabel . width / 2 ; break } } if ( delta ) { sum += reverseSep ?delta :- delta } delta = 0 ; sum += ( vLabel . dummy ?edgeSep :nodeSep ) / 2 ; sum += ( wLabel . dummy ?edgeSep :nodeSep ) / 2 ; sum += wLabel . width / 2 ; if ( _ . has ( wLabel , "labelpos" ) ) { switch ( wLabel . labelpos . toLowerCase ( ) ) { case "l" :delta = wLabel . width / 2 ; break ; case "r" :delta = - wLabel . width / 2 ; break } } if ( delta ) { sum += reverseSep ?delta :- delta } delta = 0 ; return sum } } function width ( g , v ) { return g . node ( v ) . width } } , { "../graphlib" :7 , "../lodash" :10 , "../util" :29 } ] , 24 :[ function ( require , module , exports ) { "use strict" ; var _ = require ( "../lodash" ) ; var util = require ( "../util" ) ; var positionX = require ( "./bk" ) . positionX ; module . exports = position ; function position ( g ) { g = util . asNonCompoundGraph ( g ) ; positionY ( g ) ; _ . forEach ( positionX ( g ) , function ( x , v ) { g . node ( v ) . x = x } ) } function positionY ( g ) { var layering = util . buildLayerMatrix ( g ) ; var rankSep = g . graph ( ) . ranksep ; var prevY = 0 ; _ . forEach ( layering , function ( layer ) { var maxHeight = _ . max ( _ . map ( layer , function ( v ) { return g . node ( v ) . height } ) ) ; var borderTopSeen = false ; var labelheight = 0 ; _ . forEach ( layer , function ( v ) { var node = g . node ( v ) ; console . log ( "nodeY" , node ) ; if ( node . dummy === "border" && node . whimNode ) { borderTopSeen = true ; labelheight = node . labelheight } node . y = prevY + maxHeight / 2 } ) ; if ( borderTopSeen ) { prevY += maxHeight + labelheight + 24 } else { prevY += maxHeight + rankSep } } ) } } , { "../lodash" :10 , "../util" :29 , "./bk" :23 } ] , 25 :[ function ( require , module , exports ) { "use strict" ; var _ = require ( "../lodash" ) ; var Graph = require ( "../graphlib" ) . Graph ; var slack = require ( "./util" ) . slack ; module . exports = feasibleTree ;
326
+ */ function alignCoordinates ( xss , alignTo ) { var alignToVals = _ . values ( alignTo ) , alignToMin = _ . min ( alignToVals ) , alignToMax = _ . max ( alignToVals ) ; _ . forEach ( [ "u" , "d" ] , function ( vert ) { _ . forEach ( [ "l" , "r" ] , function ( horiz ) { var alignment = vert + horiz , xs = xss [ alignment ] , delta ; if ( xs === alignTo ) return ; var xsVals = _ . values ( xs ) ; delta = horiz === "l" ?alignToMin - _ . min ( xsVals ) :alignToMax - _ . max ( xsVals ) ; if ( delta ) { xss [ alignment ] = _ . mapValues ( xs , function ( x ) { return x + delta } ) } } ) } ) } function balance ( xss , align ) { return _ . mapValues ( xss . ul , function ( ignore , v ) { if ( align ) { return xss [ align . toLowerCase ( ) ] [ v ] } else { var xs = _ . sortBy ( _ . map ( xss , v ) ) ; return ( xs [ 1 ] + xs [ 2 ] ) / 2 } } ) } function positionX ( g ) { var layering = util . buildLayerMatrix ( g ) ; var conflicts = _ . merge ( findType1Conflicts ( g , layering ) , findType2Conflicts ( g , layering ) ) ; var xss = { } ; var adjustedLayering ; _ . forEach ( [ "u" , "d" ] , function ( vert ) { adjustedLayering = vert === "u" ?layering :_ . values ( layering ) . reverse ( ) ; _ . forEach ( [ "l" , "r" ] , function ( horiz ) { if ( horiz === "r" ) { adjustedLayering = _ . map ( adjustedLayering , function ( inner ) { return _ . values ( inner ) . reverse ( ) } ) } var neighborFn = ( vert === "u" ?g . predecessors :g . successors ) . bind ( g ) ; var align = verticalAlignment ( g , adjustedLayering , conflicts , neighborFn ) ; var xs = horizontalCompaction ( g , adjustedLayering , align . root , align . align , horiz === "r" ) ; if ( horiz === "r" ) { xs = _ . mapValues ( xs , function ( x ) { return - x } ) } xss [ vert + horiz ] = xs } ) } ) ; var smallestWidth = findSmallestWidthAlignment ( g , xss ) ; alignCoordinates ( xss , smallestWidth ) ; return balance ( xss , g . graph ( ) . align ) } function sep ( nodeSep , edgeSep , reverseSep ) { return function ( g , v , w ) { var vLabel = g . node ( v ) ; var wLabel = g . node ( w ) ; var sum = 0 ; var delta ; sum += vLabel . width / 2 ; if ( _ . has ( vLabel , "labelpos" ) ) { switch ( vLabel . labelpos . toLowerCase ( ) ) { case "l" :delta = - vLabel . width / 2 ; break ; case "r" :delta = vLabel . width / 2 ; break } } if ( delta ) { sum += reverseSep ?delta :- delta } delta = 0 ; sum += ( vLabel . dummy ?edgeSep :nodeSep ) / 2 ; sum += ( wLabel . dummy ?edgeSep :nodeSep ) / 2 ; sum += wLabel . width / 2 ; if ( _ . has ( wLabel , "labelpos" ) ) { switch ( wLabel . labelpos . toLowerCase ( ) ) { case "l" :delta = wLabel . width / 2 ; break ; case "r" :delta = - wLabel . width / 2 ; break } } if ( delta ) { sum += reverseSep ?delta :- delta } delta = 0 ; return sum } } function width ( g , v ) { return g . node ( v ) . width } } , { "../graphlib" :7 , "../lodash" :10 , "../util" :29 } ] , 24 :[ function ( require , module , exports ) { "use strict" ; var _ = require ( "../lodash" ) ; var util = require ( "../util" ) ; var positionX = require ( "./bk" ) . positionX ; module . exports = position ; function position ( g ) { g = util . asNonCompoundGraph ( g ) ; positionY ( g ) ; _ . forEach ( positionX ( g ) , function ( x , v ) { g . node ( v ) . x = x } ) } function positionY ( g ) { var layering = util . buildLayerMatrix ( g ) ; var rankSep = g . graph ( ) . ranksep ; var prevY = 0 ; _ . forEach ( layering , function ( layer ) { var maxHeight = _ . max ( _ . map ( layer , function ( v ) { return g . node ( v ) . height } ) ) ; var borderTopSeen = false ; var labelheight = 0 ; _ . forEach ( layer , function ( v ) { var node = g . node ( v ) ; if ( node . dummy === "border" && node . whimNode ) { borderTopSeen = true ; labelheight = node . labelheight } node . y = prevY + maxHeight / 2 } ) ; if ( borderTopSeen ) { prevY += maxHeight + labelheight + 24 } else { prevY += maxHeight + rankSep } } ) } } , { "../lodash" :10 , "../util" :29 , "./bk" :23 } ] , 25 :[ function ( require , module , exports ) { "use strict" ; var _ = require ( "../lodash" ) ; var Graph = require ( "../graphlib" ) . Graph ; var slack = require ( "./util" ) . slack ; module . exports = feasibleTree ;
327
327
/*
328
328
* Constructs a spanning tree with tight edges and adjusted the input node's
329
329
* ranks to achieve this. A tight edge is one that is has a length that matches
@@ -513,7 +513,7 @@ function addWhimBorderNode(g,prefix,labelHeight){var node={width:0,height:0,whim
513
513
/*
514
514
* Returns a new function that wraps `fn` with a timer. The wrapper logs the
515
515
* time it takes to execute the function.
516
- */ function time ( name , fn ) { var start = _ . now ( ) ; try { return fn ( ) } finally { console . log ( name + " time: " + ( _ . now ( ) - start ) + "ms" ) } } function notime ( name , fn ) { return fn ( ) } } , { "./graphlib" :7 , "./lodash" :10 } ] , 30 :[ function ( require , module , exports ) { module . exports = "0.8.6 " } , { } ] , 31 :[ function ( require , module , exports ) {
516
+ */ function time ( name , fn ) { var start = _ . now ( ) ; try { return fn ( ) } finally { console . log ( name + " time: " + ( _ . now ( ) - start ) + "ms" ) } } function notime ( name , fn ) { return fn ( ) } } , { "./graphlib" :7 , "./lodash" :10 } ] , 30 :[ function ( require , module , exports ) { module . exports = "0.8.61 " } , { } ] , 31 :[ function ( require , module , exports ) {
517
517
/**
518
518
* Copyright (c) 2014, Chris Pettitt
519
519
* All rights reserved.
0 commit comments