From e44a7e37b6c7b5961adaffc62b9042b8d442938e Mon Sep 17 00:00:00 2001 From: mensonge Date: Thu, 13 Nov 2008 09:49:11 +0000 Subject: New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f --- includes/js/dojox/sketch/LeadAnnotation.js | 141 +++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 includes/js/dojox/sketch/LeadAnnotation.js (limited to 'includes/js/dojox/sketch/LeadAnnotation.js') diff --git a/includes/js/dojox/sketch/LeadAnnotation.js b/includes/js/dojox/sketch/LeadAnnotation.js new file mode 100644 index 0000000..40e571e --- /dev/null +++ b/includes/js/dojox/sketch/LeadAnnotation.js @@ -0,0 +1,141 @@ +if(!dojo._hasResource["dojox.sketch.LeadAnnotation"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.sketch.LeadAnnotation"] = true; +dojo.provide("dojox.sketch.LeadAnnotation"); +dojo.require("dojox.sketch.Annotation"); +dojo.require("dojox.sketch.Anchor"); + +(function(){ + var ta=dojox.sketch; + ta.LeadAnnotation=function(figure, id){ + ta.Annotation.call(this, figure, id); + this.transform={dx:0, dy:0 }; + this.start={ x:0, y:0 }; + this.control={x:100, y:-50}; + this.end={ x:200, y:0 }; + this.textPosition={ x:0, y:0 }; + this.textOffset=4; + this.textAlign="middle"; + this.textYOffset=10; + +// this.property('label',this.id); + this.pathShape=null; + this.labelShape=null; + + this.anchors.start=new ta.Anchor(this, "start"); + this.anchors.control=new ta.Anchor(this, "control"); + this.anchors.end=new ta.Anchor(this, "end"); + }; + ta.LeadAnnotation.prototype=new ta.Annotation; + var p=ta.LeadAnnotation.prototype; + p.constructor=ta.LeadAnnotation; + + p.type=function(){ return 'Lead'; } + p.getType=function(){ return ta.LeadAnnotation; }; + + p._pos=function(){ + var offset=this.textOffset, x=0, y=0; + var slope=this.calculate.slope(this.control, this.end); + if(Math.abs(slope)>=1){ + x=this.end.x+this.calculate.dx(this.control, this.end, offset); + if(this.control.y>this.end.y) y=this.end.y-offset; + else y=this.end.y+offset+this.textYOffset; + } else if(slope==0){ + x=this.end.x+offset; + y=this.end.y+this.textYOffset; + } else { + if(this.start.x>this.end.x){ + x=this.end.x-offset; + this.textAlign="end"; + } else { + x=this.end.x+offset; + this.textAlign="start"; + } + if(this.start.y' + + '' + + '' + + this.property('label') + + '' + + ''; + }; + + ta.Annotation.register("Lead"); +})(); + +} -- cgit v1.2.3-54-g00ecf