@@ -124,6 +124,7 @@ class Word {
124124 return Math . max ( minWordWidth , this . tw ) ;
125125 }
126126
127+ /* must return a value less than row width - edgepaddings, else will try to reposition long words forever! */
127128 getMaxWidth ( ) {
128129 return ( this . row . rect . width ( ) - ( edgepadding * 2 ) ) / 3.1 ;
129130 }
@@ -177,7 +178,8 @@ function checkAndUpdateWordToWordSlots(link, startSlot) { //, minWord, minSide,
177178
178179 if ( i == wo1 . idx ) { //check right side...
179180
180- if ( side1 == 0 ) { //then have to check left side too...
181+ //side1 == 0
182+ if ( side1 == sides . LEFT ) { //then have to check left side too...
181183
182184 if ( checkSlotAvailabity ( x , wordObjs [ i ] . slotsL ) ) {
183185
@@ -210,7 +212,8 @@ function checkAndUpdateWordToWordSlots(link, startSlot) { //, minWord, minSide,
210212 break ;
211213 }
212214
213- if ( side2 == 1 ) { //then have to check right side too...
215+ //side2 == 1
216+ if ( side2 == sides . RIGHT ) { //then have to check right side too...
214217
215218 if ( checkSlotAvailabity ( x , wordObjs [ i ] . slotsR ) ) {
216219 slotIsAvailable = false ;
@@ -233,7 +236,8 @@ function checkAndUpdateWordToWordSlots(link, startSlot) { //, minWord, minSide,
233236
234237 if ( i == wo1 . idx ) { //update right side...
235238
236- if ( side1 == 0 ) {
239+ //side1 == 0
240+ if ( side1 == sides . LEFT ) {
237241 wordObjs [ i ] . slotsL . push ( useSlot ) ;
238242 }
239243
@@ -248,7 +252,8 @@ function checkAndUpdateWordToWordSlots(link, startSlot) { //, minWord, minSide,
248252
249253 wordObjs [ i ] . slotsL . push ( useSlot ) ;
250254
251- if ( side2 == 1 ) {
255+ //side2 == 1
256+ if ( side2 == sides . RIGHT ) {
252257 wordObjs [ i ] . slotsR . push ( useSlot ) ;
253258 }
254259 }
@@ -475,21 +480,23 @@ function createLink(link) {
475480 //console.log("rightWord = " + link.rightWord.id);
476481
477482 //explicitly link parents of link (i.e., links that attach to this link)
478- if ( link . leftAttach == 0 ) {
483+ //if (link.leftAttach == 0) {
484+ if ( link . leftAttach == sides . LEFT ) {
479485 //console.log(link.leftWord);
480486 //console.log(link.leftWord.parentsL);
481487 link . leftWord . parentsL . push ( link ) ;
482- } else {
488+ } else if ( link . leftAttach == sides . RIGHT ) {
483489 //console.log(link.leftWord);
484490 //console.log(link.leftWord.parentsR);
485491 link . leftWord . parentsR . push ( link ) ;
486492 }
487493
488- if ( link . rightAttach == 0 ) {
494+ //if (link.rightAttach == 0) {
495+ if ( link . rightAttach == sides . LEFT ) {
489496 //console.log(link.rightWord);
490497 //console.log(link.rightWord.parentsL);
491498 link . rightWord . parentsL . push ( link ) ;
492- } else {
499+ } else if ( link . rightAttach == sides . RIGHT ) {
493500 //console.log(link.rightWord);
494501 //console.log(link.rightWord.parentsR);
495502 link . rightWord . parentsR . push ( link ) ;
0 commit comments