client/js/paper-renderer.js
changeset 82 ff79f9f4321a
parent 75 7adef9ce92aa
child 95 383d020a8af8
equal deleted inserted replaced
81:555a094e2000 82:ff79f9f4321a
   365     	}
   365     	}
   366     }, this);
   366     }, this);
   367 }
   367 }
   368 
   368 
   369 Rkns.Renderer.Node.prototype.paperShift = function(_delta) {
   369 Rkns.Renderer.Node.prototype.paperShift = function(_delta) {
   370     this.paper_coords = this.paper_coords.add(_delta);
   370 	if (!this.renderer.renkan.read_only) {
   371     this.redraw();
   371 		this.paper_coords = this.paper_coords.add(_delta);
       
   372     	this.redraw();
       
   373 	} else {
       
   374 		this.renderer.paperShift(_delta);
       
   375 	}
   372 }
   376 }
   373 
   377 
   374 Rkns.Renderer.Node.prototype.openEditor = function() {
   378 Rkns.Renderer.Node.prototype.openEditor = function() {
   375     this.renderer.removeRepresentationsOfType("editor");
   379     this.renderer.removeRepresentationsOfType("editor");
   376     var _editor = this.renderer.addRepresentation("NodeEditor",null);
   380     var _editor = this.renderer.addRepresentation("NodeEditor",null);
   575     this.renderer.click_target = null;
   579     this.renderer.click_target = null;
   576     this.renderer.is_dragging = false;
   580     this.renderer.is_dragging = false;
   577 }
   581 }
   578 
   582 
   579 Rkns.Renderer.Edge.prototype.paperShift = function(_delta) {
   583 Rkns.Renderer.Edge.prototype.paperShift = function(_delta) {
   580     this.from_representation.paperShift(_delta);
   584 	if (!this.renderer.renkan.read_only) {
   581     this.to_representation.paperShift(_delta);
   585 	    this.from_representation.paperShift(_delta);
       
   586 	    this.to_representation.paperShift(_delta);
       
   587 	} else {
       
   588 		this.renderer.paperShift(_delta);
       
   589 	}
   582 }
   590 }
   583 
   591 
   584 Rkns.Renderer.Edge.prototype.destroy = function() {
   592 Rkns.Renderer.Edge.prototype.destroy = function() {
   585     this.super("destroy");
   593     this.super("destroy");
   586     this.line.remove();
   594     this.line.remove();
  1719         }
  1727         }
  1720         this.selected_target = null;
  1728         this.selected_target = null;
  1721     }
  1729     }
  1722 }
  1730 }
  1723 
  1731 
       
  1732 Rkns.Renderer.Scene.prototype.paperShift = function(_delta) {
       
  1733 	this.offset = this.offset.add(_delta);
       
  1734     this.resetCoords();
       
  1735     this.redraw();
       
  1736 }
       
  1737 
  1724 Rkns.Renderer.Scene.prototype.onMouseMove = function(_event) {
  1738 Rkns.Renderer.Scene.prototype.onMouseMove = function(_event) {
  1725     var _hitResult = paper.project.hitTest(_event.point);
  1739     var _hitResult = paper.project.hitTest(_event.point);
  1726     if (this.is_dragging) {
  1740     if (this.is_dragging) {
  1727         if (this.click_target && typeof this.click_target.paperShift === "function" && !this.renkan.read_only) {
  1741         if (this.click_target && typeof this.click_target.paperShift === "function") {
  1728             this.click_target.paperShift(_event.delta);
  1742             this.click_target.paperShift(_event.delta);
  1729         } else {
  1743         } else {
  1730             this.offset = this.offset.add(_event.delta);
  1744             this.paperShift(_delta);
  1731             this.resetCoords();
       
  1732             this.redraw();
       
  1733         }
  1745         }
  1734     } else {
  1746     } else {
  1735         this.findTarget(_hitResult);
  1747         this.findTarget(_hitResult);
  1736     }
  1748     }
  1737 }
  1749 }