client/js/paper-renderer.js
changeset 6 a7b54105f74e
parent 5 67085e6281e5
child 7 ae86ecebb1be
equal deleted inserted replaced
5:67085e6281e5 6:a7b54105f74e
     3 Rkns.Renderers.Paper__Utils = {
     3 Rkns.Renderers.Paper__Utils = {
     4     _EDITOR_ARROW_LENGTH : 20,
     4     _EDITOR_ARROW_LENGTH : 20,
     5     _EDITOR_ARROW_WIDTH : 40,
     5     _EDITOR_ARROW_WIDTH : 40,
     6     _EDITOR_MARGIN : 15,
     6     _EDITOR_MARGIN : 15,
     7     _EDITOR_PADDING : 10,
     7     _EDITOR_PADDING : 10,
       
     8     _EDITOR_GRADIENT : new paper.Gradient(['#f0f0f0', '#d0d0d0']),
     8     drawEditBox : function(_coords, _path, _width, _height) {
     9     drawEditBox : function(_coords, _path, _width, _height) {
     9         var _isLeft = (_coords.x < paper.view.center.x ? 1 : -1),
    10         var _isLeft = (_coords.x < paper.view.center.x ? 1 : -1),
    10             _left = _coords.x + _isLeft * ( this._EDITOR_MARGIN + this._EDITOR_ARROW_LENGTH ),
    11             _left = _coords.x + _isLeft * ( this._EDITOR_MARGIN + this._EDITOR_ARROW_LENGTH ),
    11             _right = _coords.x + _isLeft * ( this._EDITOR_MARGIN + this._EDITOR_ARROW_LENGTH + _width ),
    12             _right = _coords.x + _isLeft * ( this._EDITOR_MARGIN + this._EDITOR_ARROW_LENGTH + _width ),
    12             _top = _coords.y - _height / 2;
    13             _top = _coords.y - _height / 2;
    35         _path.segments[4].point.y
    36         _path.segments[4].point.y
    36             = _path.segments[5].point.y
    37             = _path.segments[5].point.y
    37             = _bottom;
    38             = _bottom;
    38         _path.segments[1].point.y = _coords.y - this._EDITOR_ARROW_WIDTH / 2;
    39         _path.segments[1].point.y = _coords.y - this._EDITOR_ARROW_WIDTH / 2;
    39         _path.segments[6].point.y = _coords.y + this._EDITOR_ARROW_WIDTH / 2;
    40         _path.segments[6].point.y = _coords.y + this._EDITOR_ARROW_WIDTH / 2;
       
    41         _path.fillColor = new paper.GradientColor(this._EDITOR_GRADIENT, [0,_top], [0, _bottom])
    40         return {
    42         return {
    41             left: (this._EDITOR_PADDING + Math.min(_left, _right)),
    43             left: (this._EDITOR_PADDING + Math.min(_left, _right)),
    42             top: (this._EDITOR_PADDING + _top)
    44             top: (this._EDITOR_PADDING + _top)
    43         }
    45         }
    44     }
    46     }