controller.js 788 B

123456789101112131415161718192021222324252627282930313233
  1. this.triggerdownAction = 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.triggerupAction = 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({x:pos.x, y:pos.y, z:pos.z});
  19. pen.linepath.path = path;
  20. }
  21. }
  22. this.mouseupAction = function(){
  23. }
  24. this.mousedownAction = function(){
  25. }