WIP WYSIWYG ~3D SVG editor.
0
fork

Configure Feed

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

Extract built-in ZFetch rotation behavior into OrbitTool.

+11 -3
+11 -3
zoodle.js
··· 275 275 } 276 276 277 277 class OrbitTool extends Tool { 278 + constructor(editor) { 279 + super(editor); 280 + this.rotateStart = null; 281 + } 278 282 start(ptr, target, x, y) { 279 - this.editor.sceneInput.rotateStart(ptr, target, x, y); 283 + this.rotateStart = this.editor.scene.rotate.copy(); 280 284 } 281 285 move(ptr, target, x, y) { 282 - this.editor.sceneInput.rotateMove(ptr, target, x, y); 286 + let displaySize = Math.min( this.editor.scene.width, this.editor.scene.height ); 287 + let moveRY = x / displaySize * Math.PI * Zdog.TAU; 288 + let moveRX = y / displaySize * Math.PI * Zdog.TAU; 289 + this.editor.scene.rotate.x = this.rotateStart.x - moveRX; 290 + this.editor.scene.rotate.y = this.rotateStart.y - moveRY; 291 + 283 292 this.editor.syncLayers(); 284 293 } 285 294 } ··· 324 333 let delta = this.editor.getAxisDistance(x, y, Math.atan2(direction.y, direction.x)); 325 334 delta /= -this.editor.scene.zoom; // TODO: Include pixel ratio as well. 326 335 delta *= this.widget.scale.x; 327 - console.log("movin", x, y, direction, delta); 328 336 this.editor.updateHighlights(); 329 337 this.editor.updateUI(); 330 338 //let delta = new Zdog.Vector({x: x, y: y}).magnitude2d();