WIP WYSIWYG ~3D SVG editor.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Clean up TranslateTool.move, fix minor visual bugs.

Now the highlight and widgets shouldn't lag behind by a frame.

Also removed currently-unimplemented VIEW mode for translation.

+9 -11
+9 -11
zoodle.js
··· 303 303 } 304 304 start(ptr, target, x, y) { 305 305 this.widget = target; 306 - // Ensure our target is the base and not the tip. 307 - if (this.widget.diameter) 308 - this.widget = this.widget.addTo; 309 306 this.targets = this.editor.selection; 310 - this.startTranslate = this.targets.map((t) => t.translate.copy()); 311 - if (target.layer !== Zoodle.LAYER_UI) { 312 - this.mode = TranslateTool.MODE_VIEW; 307 + this.mode = TranslateTool.MODE_NONE; 308 + if (!this.targets.length || target.layer !== Zoodle.LAYER_UI || !target.color) { 313 309 return; 314 310 } 311 + // Ensure our widget target is the base and not the tip. 312 + if (this.widget.diameter) 313 + this.widget = this.widget.addTo; 314 + this.startTranslate = this.targets.map((t) => t.translate.copy()); 315 315 switch (target.color) { 316 316 case rose: 317 317 this.mode = TranslateTool.MODE_X; ··· 323 323 this.mode = TranslateTool.MODE_Z; 324 324 break; 325 325 default: 326 - this.mode = TranslateTool.MODE_VIEW; 326 + this.mode = TranslateTool.MODE_NONE; 327 327 break; 328 328 } 329 329 } ··· 333 333 let delta = this.editor.getAxisDistance(x, y, Math.atan2(direction.y, direction.x)); 334 334 delta /= -this.editor.scene.zoom; // TODO: Include pixel ratio as well. 335 335 delta *= this.widget.scale.x; 336 - this.editor.updateHighlights(); 337 - this.editor.updateUI(); 338 - //let delta = new Zdog.Vector({x: x, y: y}).magnitude2d(); 339 336 this.targets.forEach((t, i) => { 340 337 t.translate[this.mode] = this.startTranslate[i][this.mode] + delta; 341 338 }); 342 - 339 + this.editor.updateHighlights(); 340 + this.editor.updateUI(); 343 341 } 344 342 end(ptr, target, x, y) { 345 343 if (!this.mode) { return; }