controller.js 672 B

12345678910111213141516171819202122232425
  1. this.triggerdown = function(){
  2. let scene = this.getScene();
  3. this.pointer.material.color = "white";
  4. this.penDown = true;
  5. this.penName = 'drawNode-' + scene.GUID();
  6. scene.createDrawNode(scene.drawBox, this.penName, "#f9f9f9", 0.007, "0 0 0");
  7. }
  8. this.triggerup = function(){
  9. this.pointer.material.color = "green";
  10. this.penDown = false;
  11. }
  12. this.onMove = function(){
  13. if(this.penDown){
  14. let scene = this.getScene();
  15. let pen = scene.drawBox.children[this.penName];
  16. let pos = this.pointer.worldPosition();
  17. let path = pen.linepath.path.slice();
  18. path.push(pos);
  19. pen.linepath.path = path;
  20. }
  21. }