Commits

Udi Bauman committed a8dc56d

slightly nicer graphical relations

Comments (0)

Files changed (2)

model_app/views.coffee

     @el.append("rect")
       .attr("x", x)
       .attr("y", y)
-      .attr("rx", 3)
-      .attr("ry", 3)
+      .attr("rx", 5)
+      .attr("ry", 5)
       .attr("width", w)
       .attr("height", h)
     @el.selectAll("text")
     if @model.has_super()
       for sc in @model.get "super_classes"
         super_view = @class_views_by_name[sc]
-        @el.append("line")
-        .attr("x1", @top_connect_point.x)
-        .attr("y1", @top_connect_point.y)
-        .attr("x2", super_view.bottom_connect_point.x)
-        .attr("y2", super_view.bottom_connect_point.y)
+        points = []
+        points[0] = x: @top_connect_point.x, y: @top_connect_point.y
+        points[1] = x: super_view.bottom_connect_point.x, y: super_view.bottom_connect_point.y
+        path_d = "M" + points[0].x + "," + points[0].y
+        path_d += " C" + points[0].x + "," + (points[0].y-50)
+        path_d += " " + points[1].x + "," + (points[1].y+50)
+        path_d += " " + points[1].x + "," + points[1].y
+        # TODO use d3.js helper functions
+        @el.append("path")
+          .attr("d", path_d)
+          .attr("stroke", "black")
+          .attr("fill", "none")
 
     return @
 

static/js/views.js

     };
 
     ClassView.prototype.render = function() {
-      var data, h, level, margin, sc, super_view, w, x, y, _i, _len, _ref,
+      var data, h, level, margin, path_d, points, sc, super_view, w, x, y, _i, _len, _ref,
         _this = this;
       data = this.model.get_all_members();
       if (data.length < 2) {
       w = this.default_class_width;
       margin = 10;
       this.el = this.svg.append("g").attr("x", x).attr("y", y);
-      this.el.append("rect").attr("x", x).attr("y", y).attr("rx", 3).attr("ry", 3).attr("width", w).attr("height", h);
+      this.el.append("rect").attr("x", x).attr("y", y).attr("rx", 5).attr("ry", 5).attr("width", w).attr("height", h);
       this.el.selectAll("text").data(data).enter().append("text").attr("x", x + margin).attr("y", function(d, i) {
         return y + margin + i * _this.default_member_height;
       }).attr("dy", ".35em").text(String);
         for (_i = 0, _len = _ref.length; _i < _len; _i++) {
           sc = _ref[_i];
           super_view = this.class_views_by_name[sc];
-          this.el.append("line").attr("x1", this.top_connect_point.x).attr("y1", this.top_connect_point.y).attr("x2", super_view.bottom_connect_point.x).attr("y2", super_view.bottom_connect_point.y);
+          points = [];
+          points[0] = {
+            x: this.top_connect_point.x,
+            y: this.top_connect_point.y
+          };
+          points[1] = {
+            x: super_view.bottom_connect_point.x,
+            y: super_view.bottom_connect_point.y
+          };
+          path_d = "M" + points[0].x + "," + points[0].y;
+          path_d += " C" + points[0].x + "," + (points[0].y - 50);
+          path_d += " " + points[1].x + "," + (points[1].y + 50);
+          path_d += " " + points[1].x + "," + points[1].y;
+          this.el.append("path").attr("d", path_d).attr("stroke", "black").attr("fill", "none");
         }
       }
       return this;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.