Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / drawing / ui / dom / Zoom.js

History | View | Annotate | Download (2.08 KB)

1
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6

    
7

    
8
if(!dojo._hasResource["dojox.drawing.ui.dom.Zoom"]){
9
dojo._hasResource["dojox.drawing.ui.dom.Zoom"]=true;
10
dojo.provide("dojox.drawing.ui.dom.Zoom");
11
dojo.require("dojox.drawing.plugins._Plugin");
12
dojox.drawing.ui.dom.Zoom=dojox.drawing.util.oo.declare(dojox.drawing.plugins._Plugin,function(_1){
13
var _2=_1.node.className;
14
var _3=_1.node.innerHTML;
15
this.domNode=dojo.create("div",{id:"btnZoom","class":"toolCombo"},_1.node,"replace");
16
this.makeButton("ZoomIn",this.topClass);
17
this.makeButton("Zoom100",this.midClass);
18
this.makeButton("ZoomOut",this.botClass);
19
},{type:"dojox.drawing.ui.dom.Zoom",zoomInc:0.1,maxZoom:10,minZoom:0.1,zoomFactor:1,baseClass:"drawingButton",topClass:"toolComboTop",midClass:"toolComboMid",botClass:"toolComboBot",makeButton:function(_4,_5){
20
var _6=dojo.create("div",{id:"btn"+_4,"class":this.baseClass+" "+_5,innerHTML:"<div title=\"Zoom In\" class=\"icon icon"+_4+"\"></div>"},this.domNode);
21
dojo.connect(document,"mouseup",function(_7){
22
dojo.stopEvent(_7);
23
dojo.removeClass(_6,"active");
24
});
25
dojo.connect(_6,"mouseup",this,function(_8){
26
dojo.stopEvent(_8);
27
dojo.removeClass(_6,"active");
28
this["on"+_4]();
29
});
30
dojo.connect(_6,"mouseover",function(_9){
31
dojo.stopEvent(_9);
32
dojo.addClass(_6,"hover");
33
});
34
dojo.connect(_6,"mousedown",this,function(_a){
35
dojo.stopEvent(_a);
36
dojo.addClass(_6,"active");
37
});
38
dojo.connect(_6,"mouseout",this,function(_b){
39
dojo.stopEvent(_b);
40
dojo.removeClass(_6,"hover");
41
});
42
},onZoomIn:function(_c){
43
this.zoomFactor+=this.zoomInc;
44
this.zoomFactor=Math.min(this.zoomFactor,this.maxZoom);
45
this.canvas.setZoom(this.zoomFactor);
46
this.mouse.setZoom(this.zoomFactor);
47
},onZoom100:function(_d){
48
this.zoomFactor=1;
49
this.canvas.setZoom(this.zoomFactor);
50
this.mouse.setZoom(this.zoomFactor);
51
},onZoomOut:function(_e){
52
this.zoomFactor-=this.zoomInc;
53
this.zoomFactor=Math.max(this.zoomFactor,this.minZoom);
54
this.canvas.setZoom(this.zoomFactor);
55
this.mouse.setZoom(this.zoomFactor);
56
}});
57
}