220 |
220 |
221 Rkns.Renderer._BaseRepresentation.prototype.super = function(_func) { |
221 Rkns.Renderer._BaseRepresentation.prototype.super = function(_func) { |
222 Rkns.Renderer._BaseRepresentation.prototype[_func].apply(this, Array.prototype.slice.call(arguments, 1)); |
222 Rkns.Renderer._BaseRepresentation.prototype[_func].apply(this, Array.prototype.slice.call(arguments, 1)); |
223 } |
223 } |
224 |
224 |
|
225 Rkns.Renderer._BaseRepresentation.prototype.redraw = function() {} |
|
226 |
225 Rkns.Renderer._BaseRepresentation.prototype.moveTo = function() {} |
227 Rkns.Renderer._BaseRepresentation.prototype.moveTo = function() {} |
226 |
228 |
227 Rkns.Renderer._BaseRepresentation.prototype.show = function() {} |
229 Rkns.Renderer._BaseRepresentation.prototype.show = function() {} |
228 |
230 |
229 Rkns.Renderer._BaseRepresentation.prototype.hide = function() {} |
231 Rkns.Renderer._BaseRepresentation.prototype.hide = function() {} |
273 this.renderer.minimap.node_layer.activate(); |
275 this.renderer.minimap.node_layer.activate(); |
274 this.minimap_circle = new paper.Path.Circle([0, 0], 1); |
276 this.minimap_circle = new paper.Path.Circle([0, 0], 1); |
275 this.renderer.minimap.node_group.addChild(this.minimap_circle); |
277 this.renderer.minimap.node_group.addChild(this.minimap_circle); |
276 } |
278 } |
277 |
279 |
278 Rkns.Renderer.Node.prototype.redraw = function() { |
280 Rkns.Renderer.Node.prototype.redraw = function(_dontRedrawEdges) { |
279 var _model_coords = new paper.Point(this.model.get("position")), |
281 var _model_coords = new paper.Point(this.model.get("position")), |
280 _baseRadius = Rkns.Renderer._NODE_SIZE_BASE * Math.exp((this.model.get("size") || 0) * Rkns.Renderer._NODE_SIZE_STEP); |
282 _baseRadius = Rkns.Renderer._NODE_SIZE_BASE * Math.exp((this.model.get("size") || 0) * Rkns.Renderer._NODE_SIZE_STEP); |
281 if (!this.is_dragging || !this.paper_coords) { |
283 if (!this.is_dragging || !this.paper_coords) { |
282 this.paper_coords = this.renderer.toPaperCoords(_model_coords); |
284 this.paper_coords = this.renderer.toPaperCoords(_model_coords); |
283 } |
285 } |
356 this.minimap_circle.fillColor = _color; |
358 this.minimap_circle.fillColor = _color; |
357 var minipos = this.renderer.toMinimapCoords(_model_coords), |
359 var minipos = this.renderer.toMinimapCoords(_model_coords), |
358 miniradius = this.renderer.minimap.scale * _baseRadius, |
360 miniradius = this.renderer.minimap.scale * _baseRadius, |
359 minisize = new paper.Size([miniradius, miniradius]); |
361 minisize = new paper.Size([miniradius, miniradius]); |
360 this.minimap_circle.fitBounds(minipos.subtract(minisize), minisize.multiply(2)); |
362 this.minimap_circle.fitBounds(minipos.subtract(minisize), minisize.multiply(2)); |
361 |
363 |
362 Rkns._.each(this.project.get("edges").filter(function (ed) { return ((ed.to === this.model) || (ed.from === this.model));}), function(edge, index, list){ |
364 if (!_dontRedrawEdges) { |
363 var repr = this.renderer.getRepresentationByModel(edge); |
365 Rkns._.each(this.project.get("edges").filter(function (ed) { return ((ed.to === this.model) || (ed.from === this.model));}), function(edge, index, list){ |
364 if(repr != null && typeof repr.from_representation.paper_coords !== "undefined" && typeof repr.to_representation.paper_coords !== "undefined") { |
366 var repr = this.renderer.getRepresentationByModel(edge); |
365 repr.redraw(); |
367 if(repr != null && typeof repr.from_representation.paper_coords !== "undefined" && typeof repr.to_representation.paper_coords !== "undefined") { |
366 } |
368 repr.redraw(); |
367 }, this); |
369 } |
|
370 }, this); |
|
371 } |
|
372 |
368 } |
373 } |
369 |
374 |
370 Rkns.Renderer.Node.prototype.paperShift = function(_delta) { |
375 Rkns.Renderer.Node.prototype.paperShift = function(_delta) { |
371 if (this.renderer.renkan.options.editor_mode) { |
376 if (this.renderer.renkan.options.editor_mode) { |
372 if (!this.renderer.renkan.read_only) { |
377 if (!this.renderer.renkan.read_only) { |
509 } |
514 } |
510 |
515 |
511 Rkns.Renderer.Edge.prototype.redraw = function() { |
516 Rkns.Renderer.Edge.prototype.redraw = function() { |
512 this.from_representation = this.renderer.getRepresentationByModel(this.model.get("from")); |
517 this.from_representation = this.renderer.getRepresentationByModel(this.model.get("from")); |
513 this.to_representation = this.renderer.getRepresentationByModel(this.model.get("to")); |
518 this.to_representation = this.renderer.getRepresentationByModel(this.model.get("to")); |
|
519 if (!this.from_representation || !this.to_representation) { |
|
520 return; |
|
521 } |
514 var _p0a = this.from_representation.paper_coords, |
522 var _p0a = this.from_representation.paper_coords, |
515 _p1a = this.to_representation.paper_coords, |
523 _p1a = this.to_representation.paper_coords, |
516 _v = _p1a.subtract(_p0a), |
524 _v = _p1a.subtract(_p0a), |
517 _r = _v.length, |
525 _r = _v.length, |
518 _u = _v.divide(_r), |
526 _u = _v.divide(_r), |