Ignore:
Timestamp:
04/06/14 12:18:53 (10 years ago)
Author:
mmichalski
Message:

Draw U-Shapes connections

File:
1 edited

Legend:

Unmodified
Added
Removed
  • js/viewer-f0/js/NeuronDrawer.js

    r208 r214  
    1111    this._scale = 1;
    1212    this._min_scale = 0.1;
     13    this._lineDebug = false;
    1314    //Kinetic.js
    1415    this._stage = undefined;
     
    1718
    1819NeuronDrawer.prototype.initializeNewCanvas = function () {
     20
     21    if(typeof (this._canvasWidth) == "undefined" && typeof (this._canvasHeight) == "undefined")
     22        {
     23        var div = $("#" + this._containerContextName);
     24        this._canvasWidth = div.width();
     25        this._canvasHeight = div.height();
     26    }
    1927
    2028    this._stage = new Kinetic.Stage({
     
    150158        yw += this._neurons[neuroId].y;//add position of object to y
    151159
     160        //Inputs
    152161        points.push(this._neurons[neuroId].x);//x
    153162        points.push(yw);//y
     
    156165        points.push(yw);//y
    157166
    158         points.push(n2.x+n2.sizeX);
    159         points.push(n2.y + n2.sizeY/2);
    160 
    161         /*if(diagram?)
     167        //straight line to second neuron
     168        if(this._lineDebug || (this._neurons[neuroId].x > n2.x))
    162169        {
    163             //straight forward
     170            points.push(n2.x+n2.sizeX);
     171            points.push(n2.y + n2.sizeY/2);
    164172        }
    165173        else
    166174        {
    167             //U-shape
    168         }*/
     175            //U - shape
     176            //Vertical
     177            points.push(this._neurons[neuroId].x - xw);//x
     178            points.push(n2.y + n2.sizeY + (input+1)*5);//y
     179
     180            //Horizontal
     181            points.push(n2.x + n2.sizeX);//x
     182            points.push(n2.y + n2.sizeY + (input+1)*5);//y
     183
     184            //Vertical
     185            points.push(n2.x + n2.sizeX);//x
     186            points.push(n2.y + n2.sizeY/2);//y
     187        }
    169188
    170189        var line = new Kinetic.Line({
Note: See TracChangeset for help on using the changeset viewer.