equal
deleted
inserted
replaced
174 }; |
174 }; |
175 this._project.updateElement(this._element, _data, Rkns._SAVE); |
175 this._project.updateElement(this._element, _data, Rkns._SAVE); |
176 this._renderer.redraw(); |
176 this._renderer.redraw(); |
177 } |
177 } |
178 |
178 |
|
179 Rkns.Renderer.Node.prototype.openEditor = function() { |
|
180 this._renderer.removeControllersOfType("editor"); |
|
181 var _editor = this._renderer.addController("NodeEditor",{}); |
|
182 _editor.node_controller = this; |
|
183 _editor.redraw(); |
|
184 } |
|
185 |
179 Rkns.Renderer.Node.prototype.select = function() { |
186 Rkns.Renderer.Node.prototype.select = function() { |
180 this.circle.strokeWidth = 3; |
187 this.circle.strokeWidth = 3; |
181 this.edit_button.show(); |
188 this.edit_button.show(); |
182 this.remove_button.show(); |
189 this.remove_button.show(); |
183 } |
190 } |
190 this.circle.strokeWidth = 1; |
197 this.circle.strokeWidth = 1; |
191 } |
198 } |
192 |
199 |
193 Rkns.Renderer.Node.prototype.mouseup = function(_event) { |
200 Rkns.Renderer.Node.prototype.mouseup = function(_event) { |
194 if (!this._renderer.is_dragging) { |
201 if (!this._renderer.is_dragging) { |
195 this._renderer.removeControllersOfType("editor"); |
202 this.openEditor(); |
196 var _editor = this._renderer.addController("NodeEditor",{}); |
|
197 _editor.node_controller = this; |
|
198 _editor.redraw(); |
|
199 } |
203 } |
200 } |
204 } |
201 |
205 |
202 Rkns.Renderer.Node.prototype.destroy = function(_event) { |
206 Rkns.Renderer.Node.prototype.destroy = function(_event) { |
203 this.edit_button.destroy(); |
207 this.edit_button.destroy(); |
401 Rkns._SAVE |
405 Rkns._SAVE |
402 ); |
406 ); |
403 _this.node_controller.redraw(); |
407 _this.node_controller.redraw(); |
404 paper.view.draw(); |
408 paper.view.draw(); |
405 }); |
409 }); |
|
410 this.editor_$.find(".Rk-Edit-Title")[0].focus(); |
406 } |
411 } |
407 |
412 |
408 Rkns.Renderer.NodeEditor.prototype.destroy = function() { |
413 Rkns.Renderer.NodeEditor.prototype.destroy = function() { |
409 this.editor_block.remove(); |
414 this.editor_block.remove(); |
410 this.editor_$.detach(); |
415 this.editor_$.detach(); |
514 this.node_controller.remove_button.hide(); |
519 this.node_controller.remove_button.hide(); |
515 } |
520 } |
516 |
521 |
517 Rkns.Renderer.NodeEditButton.prototype.mouseup = function() { |
522 Rkns.Renderer.NodeEditButton.prototype.mouseup = function() { |
518 if (!this._renderer.is_dragging) { |
523 if (!this._renderer.is_dragging) { |
519 this.node_controller.mouseup(); |
524 this.node_controller.openEditor(); |
520 } |
525 } |
521 } |
526 } |
522 |
527 |
523 Rkns.Renderer.NodeEditButton.prototype.destroy = function() { |
528 Rkns.Renderer.NodeEditButton.prototype.destroy = function() { |
524 this.sector.group.remove(); |
529 this.sector.group.remove(); |
750 _event.pageX - _off.left, |
755 _event.pageX - _off.left, |
751 _event.pageY - _off.top |
756 _event.pageY - _off.top |
752 ]); |
757 ]); |
753 var _hitResult = paper.project.hitTest(_point); |
758 var _hitResult = paper.project.hitTest(_point); |
754 if (!_hitResult || typeof _hitResult.item.__controller === "undefined") { |
759 if (!_hitResult || typeof _hitResult.item.__controller === "undefined") { |
755 var _coords = this.toModelCoords(_point); |
760 var _coords = this.toModelCoords(_point), |
756 this._project.addNode({ |
761 _node = this._project.addNode({ |
757 position: { |
762 position: { |
758 x: _coords.x, |
763 x: _coords.x, |
759 y: _coords.y |
764 y: _coords.y |
760 } |
765 } |
761 }, Rkns._RENDER_AND_SAVE); |
766 }, Rkns._RENDER_AND_SAVE); |
|
767 _node.__controller.openEditor(); |
762 } |
768 } |
763 paper.view.draw(); |
769 paper.view.draw(); |
764 } |
770 } |