ta » DoubleArrowAnnotation » initialize
ta.DoubleArrowAnnotation.initialize
dojo.require("dojox.sketch.DoubleArrowAnnotation");
defined in dojox/sketch/DoubleArrowAnnotation.js
Usage
function (obj) (view source)
var font=(ta.Annotation.labelFont)?ta.Annotation.labelFont:{family:"Times", size:"16px"}; this.apply(obj); // calculate the other positions this._rot(); this._pos(); // rotation matrix var rot=this.startRotation; if(this.control.x<this.start.x) rot+=Math.PI; var startRot=dojox.gfx.matrix.rotate(rot); rot=this.endRotation; if(this.control.x>=this.end.x) rot+=Math.PI; var endRot=dojox.gfx.matrix.rotateAt(rot, this.end.x, this.end.y); // draw the shapes this.shape=this.figure.group.createGroup(); this.shape.getEventSource().setAttribute("id", this.id); if(this.transform.dx||this.transform.dy) this.shape.setTransform(this.transform); this.pathShape=this.shape.createPath( "M"+this.start.x+" "+this.start.y+"Q"+this.control.x+" "+this.control.y+" "+this.end.x+" "+this.end.y + " l0,0" ).setStroke(this.property('stroke')); this.startArrowGroup=this.shape.createGroup().setTransform({ dx:this.start.x, dy:this.start.y }); this.startArrowGroup.applyTransform(startRot); // console.log('startArrow',this.property('fill')); this.startArrow=this.startArrowGroup.createPath("M0,0 l20,-5 -3,5 3,5 Z").setFill(this.property('fill')); this.endArrowGroup=this.shape.createGroup().setTransform(endRot); this.endArrow=this.endArrowGroup.createPath( "M" + this.end.x + "," + this.end.y + " l-20,-5 3,5 -3,5 Z" ).setFill(this.property('fill')); this.labelShape=this.shape.createText({ x:this.textPosition.x, y:this.textPosition.y, text:this.property('label'), align:this.textAlign }).setFont(font).setFill(this.property('fill'));
parameter | type | description |
---|---|---|
obj |