Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / image / Magnifier.js @ 12

History | View | Annotate | Download (1.31 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.image.Magnifier"]){
9
dojo._hasResource["dojox.image.Magnifier"]=true;
10
dojo.provide("dojox.image.Magnifier");
11
dojo.require("dojox.gfx");
12
dojo.require("dojox.image.MagnifierLite");
13
dojo.declare("dojox.image.Magnifier",dojox.image.MagnifierLite,{_createGlass:function(){
14
this.glassNode=dojo.create("div",{style:{height:this.glassSize+"px",width:this.glassSize+"px"},"className":"glassNode"},dojo.body());
15
this.surfaceNode=dojo.create("div",null,this.glassNode);
16
this.surface=dojox.gfx.createSurface(this.surfaceNode,this.glassSize,this.glassSize);
17
this.img=this.surface.createImage({src:this.domNode.src,width:this._zoomSize.w,height:this._zoomSize.h});
18
},_placeGlass:function(e){
19
var x=e.pageX-2,y=e.pageY-2,_1=this.offset.x+this.offset.w+2,_2=this.offset.y+this.offset.h+2;
20
if(x<this.offset.x||y<this.offset.y||x>_1||y>_2){
21
this._hideGlass();
22
}else{
23
this.inherited(arguments);
24
}
25
},_setImage:function(e){
26
var _3=(e.pageX-this.offset.l)/this.offset.w,_4=(e.pageY-this.offset.t)/this.offset.h,x=(this._zoomSize.w*_3*-1)+(this.glassSize*_3),y=(this._zoomSize.h*_4*-1)+(this.glassSize*_4);
27
this.img.setShape({x:x,y:y});
28
}});
29
}