Skip to content

Commit f836edf

Browse files
author
angusforbes
committed
Cleans up dragging code a bit, no longer need to rely on hack-y realign()
method anymore.
1 parent f216aa8 commit f836edf

File tree

5 files changed

+187
-234
lines changed

5 files changed

+187
-234
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136

137137

138138
// 1. create Words and Links objects (in utils.js) */
139-
var wordObjs = createTestWords(20, 5, 11);
139+
var wordObjs = createTestWords(12, 5, 11);
140140
//var wordObjs = [];
141141
//wordObjs.push(new Word("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0));
142142
//wordObjs.push(new Word("bbbbbbbbbbbbbbbbbbbbbbbbbb", 1));

js/annotate.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,27 +130,37 @@ class Word {
130130
//take temp values and update actual svg values
131131
update() {
132132

133-
//console.log("\n***\nin update : " + this.tempW);
133+
// console.log("\n***\nin update X = " + this.tempX + ", Y = " + this.tempY + ", W = " + this.tempW );
134134
this.rectSVG.x(this.tempX);
135+
//this.rectSVG.y(this.tempY);
135136
this.rectSVG.width(this.tempW);
136137

137138
this.underneathRect.x(this.tempX);
139+
//this.underneathRect.y(this.tempY);
138140
this.underneathRect.width(this.tempW);
139141

140-
141-
this.rect = this.rectSVG.bbox();
142+
this.rect = this.rectSVG.bbox();
142143

143144

144145

145146
this.text.x(this.tempX + (this.tempW/2) - (this.text.bbox().w / 2) );
147+
//this.text.y(this.tempY + textpaddingY);
148+
149+
146150
this.leftX = this.tempX;
147151
this.rightX = this.tempX + this.tempW;
148152

149153
this.percPos = (this.leftX-edgepadding) / (svgWidth-edgepadding*2);
150154

155+
156+
//var handley = this.tempY + ( this.wh / 2 ) - ( handleH / 2 );
157+
151158
this.leftHandle.x(this.tempX);
152-
this.rightHandle.x(this.rightX - handleW);
159+
//this.leftHandle.y(handley);
160+
153161

162+
this.rightHandle.x(this.rightX - handleW);
163+
//this.rightHandle.y(handley);
154164

155165
}
156166

0 commit comments

Comments
 (0)