Skip to content

Commit

Permalink
Include updates from dojo in files that overlap with
Browse files Browse the repository at this point in the history
dojotoolkit repository.
  • Loading branch information
bvds committed Feb 5, 2009
1 parent ec1fa23 commit 2669516
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 19 deletions.
3 changes: 2 additions & 1 deletion web-UI/dojotoolkit/dojox/sketch/Anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ dojo.require("dojox.gfx");
this.zoom=function(pct){
if(this.shape){
var rs=Math.floor(size/pct);
this.shape.setShape({ x:an[id].x-rs, y:an[id].y-rs, width:rs*2, height:rs*2 }).setStroke({ color:"black", width:1/pct }); //For IE, maybe we need Math.ceil(1/pct)||1
var width=dojox.gfx.renderer=='vml'?1:1/pct
this.shape.setShape({ x:an[id].x-rs, y:an[id].y-rs, width:rs*2, height:rs*2 }).setStroke({ color:"black", width:width }); //For IE, maybe we need Math.ceil(1/pct)||1
}
}
/*this.doChange=function(pt){
Expand Down
17 changes: 12 additions & 5 deletions web-UI/dojotoolkit/dojox/sketch/Annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,26 @@ dojo.require("dojox.sketch._Plugin");
};
p.zoom=function(pct){
pct = pct || this.figure.zoomFactor;
if(this.pathShape){
var s=dojo.clone(this.property('stroke'));
s.width=pct>1?s.width:Math.ceil(s.width/pct)+"px";
this.pathShape.setStroke(s);
}
if(this.labelShape){
var f=dojo.clone(this.property('font'));
f.size=Math.ceil(f.size/pct)+"px";
this.labelShape.setFont(f);
}

for(var n in this.anchors){
this.anchors[n].zoom(pct);
}

//In VML, path are always the same width no matter scaling factors,
//so aways use 1 for VML
if(dojox.gfx.renderer=='vml'){
pct=1;
}
if(this.pathShape){
var s=dojo.clone(this.property('stroke'));
s.width=pct>1?s.width:Math.ceil(s.width/pct)+"px";
this.pathShape.setStroke(s);
}
};
p.writeCommonAttrs=function(){
return 'id="' + this.id + '" dojoxsketch:type="' + this.type() + '"'
Expand Down
11 changes: 5 additions & 6 deletions web-UI/dojotoolkit/dojox/sketch/DoubleArrowAnnotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,12 @@ dojo.require("dojox.sketch.Anchor");
p.zoom=function(pct){
if(this.startArrow){
pct = pct || this.figure.zoomFactor;
if(this._curPct!==pct){
this._curPct=pct;
var l=pct>1?20:Math.floor(20/pct), w=pct>1?5:Math.floor(5/pct),h=pct>1?3:Math.floor(3/pct);
this.startArrow.setShape("M0,0 l"+l+",-"+w+" -"+h+","+w+" "+h+","+w+" Z");//.setFill(this.property('fill'));
this.endArrow.setShape("M" + this.end.x + "," + this.end.y + " l-"+l+",-"+w+" "+h+","+w+" -"+h+","+w+" Z");
}
ta.Annotation.prototype.zoom.call(this,pct);

var l=pct>1?20:Math.floor(20/pct), w=pct>1?5:Math.floor(5/pct),h=pct>1?3:Math.floor(3/pct);
this.startArrow.setShape("M0,0 l"+l+",-"+w+" -"+h+","+w+" "+h+","+w+" Z");//.setFill(this.property('fill'));

this.endArrow.setShape("M" + this.end.x + "," + this.end.y + " l-"+l+",-"+w+" "+h+","+w+" -"+h+","+w+" Z");
}
};

Expand Down
3 changes: 2 additions & 1 deletion web-UI/dojotoolkit/dojox/sketch/PreexistingAnnotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ dojo.require("dojox.sketch.Anchor");
p.zoom=function(pct){
if(this.rectShape){
pct = pct || this.figure.zoomFactor;
this.rectShape.setStroke({color:this.property('fill'), width:1/pct});
ta.Annotation.prototype.zoom.call(this,pct);
pct = dojox.gfx.renderer=='vml'?1:pct;
this.rectShape.setStroke({color:this.property('fill'), width:1/pct});
}
};
p.serialize=function(){
Expand Down
3 changes: 2 additions & 1 deletion web-UI/dojotoolkit/dojox/sketch/SingleArrowAnnotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,13 @@ dojo.require("dojox.sketch.Anchor");
p.zoom=function(pct){
if(this.arrowhead){
pct = pct || this.figure.zoomFactor;
ta.Annotation.prototype.zoom.call(this,pct);
//pct = dojox.gfx.renderer=='vml'?1:pct;
if(this._curPct!==pct){
this._curPct=pct;
var l=pct>1?20:Math.floor(20/pct), w=pct>1?5:Math.floor(5/pct),h=pct>1?3:Math.floor(3/pct);
this.arrowhead.setShape("M0,0 l"+l+",-"+w+" -"+h+","+w+" "+h+","+w+" Z");
}
ta.Annotation.prototype.zoom.call(this,pct);
}
};

Expand Down
1 change: 1 addition & 0 deletions web-UI/dojotoolkit/dojox/sketch/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dojo.require("dijit.form.Slider");
dojo.declare("dojox.sketch.Slider",dojox.sketch._Plugin,{
_initButton: function(){
this.slider=new dijit.form.HorizontalSlider({minimum:20,maximum:200,value:20,style:"width:200px;float:right"});
this.slider._movable.node.title='Double Click to "Zoom to Fit"'; //I18N
this.connect(this.slider,'onChange','_setZoom');
this.connect(this.slider.sliderHandle,'ondblclick','_zoomToFit');
},
Expand Down
12 changes: 8 additions & 4 deletions web-UI/dojotoolkit/dojox/sketch/UnderlineAnnotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ dojo.require("dojox.sketch.Anchor");
x:0,
y:0,
text:this.property('label'),
decoration:"underline",
align:"start"
})
//.setFont(font)
Expand All @@ -92,8 +93,9 @@ dojo.require("dojox.sketch.Anchor");
};
p.getBBox=function(){
var b=this.getTextBox();
// console.log('getBBox',b,this.getLabel());
return { x:0, y:(b.h*-1+4)/this.figure.zoomFactor, width:(b.w+2)/this.figure.zoomFactor, height:b.h/this.figure.zoomFactor };
var z=this.figure.zoomFactor;

return { x:0, y:(b.h*-1+4)/z, width:(b.w+2)/z, height:b.h/z };
};
p.draw=function(obj){
this.apply(obj);
Expand All @@ -103,10 +105,12 @@ dojo.require("dojox.sketch.Anchor");
this.zoom();
};
p.zoom=function(pct){
if(this.lineShape){
if(this.labelShape){
pct = pct || this.figure.zoomFactor;
var textwidthadj=dojox.gfx.renderer=='vml'?0:2/pct;
ta.Annotation.prototype.zoom.call(this,pct);
this.lineShape.setShape({ x1:1, x2:this.labelShape.getTextWidth()+1, y1:2, y2:2 })
pct = dojox.gfx.renderer=='vml'?1:pct;
this.lineShape.setShape({ x1:0, x2:this.getBBox().width-textwidthadj, y1:2, y2:2 })
.setStroke({ color:this.property('fill'), width:1/pct });
if(this.mode==ta.Annotation.Modes.Edit){
this.drawBBox(); //the bbox is dependent on the size of the text, so need to update it here
Expand Down
2 changes: 1 addition & 1 deletion web-UI/dojotoolkit/dojox/sketch/_Plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dojo.declare("dojox.sketch._Plugin", null, {
var className = this.iconClassPrefix+" "+this.iconClassPrefix + this.shape.charAt(0).toUpperCase() + this.shape.substr(1);
if(!this.button){
var props = {
label: this.shape,
label: this.shape, //I18N
showLabel: false,
iconClass: className,
dropDown: this.dropDown,
Expand Down

0 comments on commit 2669516

Please sign in to comment.