summaryrefslogtreecommitdiffstatshomepage
path: root/includes/js/dojox/image/MagnifierLite.js
diff options
context:
space:
mode:
authorGravatar mensonge2008-11-14 15:39:19 +0000
committerGravatar mensonge2008-11-14 15:39:19 +0000
commit1c5685d68f1b73270fb814fe04cbb490eb90ba5f (patch)
tree3d3ada08a934b96fc31531f1327690d7edc6f766 /includes/js/dojox/image/MagnifierLite.js
parent104d59099e048688c4dbac37d72137006e396558 (diff)
downloadscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.gz
scuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.zip
Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/image/MagnifierLite.js')
-rw-r--r--includes/js/dojox/image/MagnifierLite.js126
1 files changed, 0 insertions, 126 deletions
diff --git a/includes/js/dojox/image/MagnifierLite.js b/includes/js/dojox/image/MagnifierLite.js
deleted file mode 100644
index 2e37340..0000000
--- a/includes/js/dojox/image/MagnifierLite.js
+++ /dev/null
@@ -1,126 +0,0 @@
-if(!dojo._hasResource["dojox.image.MagnifierLite"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.image.MagnifierLite"] = true;
-dojo.provide("dojox.image.MagnifierLite");
-dojo.experimental("dojox.image.MagnifierLite");
-
-dojo.require("dijit._Widget");
-
-dojo.declare("dojox.image.MagnifierLite",
- [dijit._Widget],{
- // summary: Adds magnification on a portion of an image element
- //
- // description: An unobtrusive way to add an unstyled overlay
- // above the srcNode image element. The overlay/glass is a
- // scaled version of the src image (so larger images sized down
- // are clearer).
- //
- // The logic behind requiring the src image to be large is
- // "it's going to be downloaded, anyway" so this method avoids
- // having to make thumbnails and 2 http requests among other things.
- //
- // glassSize: Int
- // the width and height of the bounding box
- glassSize: 125,
-
- // scale: Decimal
- // the multiplier of the Mangification.
- scale: 6,
-
- postCreate: function(){
- this.inherited(arguments);
-
- // images are hard to make into workable templates, so just add outer overlay
- // and skip using dijit._Templated
- this._adjustScale();
- this._createGlass();
-
- this.connect(this.domNode,"onmouseenter","_showGlass");
- this.connect(this.glassNode,"onmousemove","_placeGlass");
- this.connect(this.img,"onmouseout","_hideGlass");
-
- // when position of domNode changes, _adjustScale needs to run.
- // window.resize isn't it always, FIXME:
- this.connect(window,"onresize","_adjustScale");
-
- },
-
- _createGlass: function(){
- // summary: make img and glassNode elements as children of the body
-
- this.glassNode = dojo.doc.createElement('div');
- this.surfaceNode = this.glassNode.appendChild(dojo.doc.createElement('div'));
- dojo.addClass(this.glassNode,"glassNode");
- dojo.body().appendChild(this.glassNode);
- with(this.glassNode.style){
- height = this.glassSize + "px";
- width = this.glassSize + "px";
- }
-
- this.img = dojo.doc.createElement('img');
- this.glassNode.appendChild(this.img);
- this.img.src = this.domNode.src;
- // float the image around inside the .glassNode
- with(this.img.style){
- position = "relative";
- top = 0; left = 0;
- width = this._zoomSize.w+"px";
- height = this._zoomSize.h+"px";
- }
-
- },
-
- _adjustScale: function(){
- // summary: update the calculations should this.scale change
-
- this.offset = dojo.coords(this.domNode,true);
- this._imageSize = { w: this.offset.w, h:this.offset.h };
- this._zoomSize = {
- w: this._imageSize.w * this.scale,
- h: this._imageSize.h * this.scale
- };
- },
-
- _showGlass: function(e){
- // summary: show the overlay
- this._placeGlass(e);
- with(this.glassNode.style){
- visibility = "visible";
- display = "";
- }
-
- },
-
- _hideGlass: function(e){
- // summary: hide the overlay
- this.glassNode.style.visibility = "hidden";
- this.glassNode.style.display = "none";
- },
-
- _placeGlass: function(e){
- // summary: position the overlay centered under the cursor
-
- this._setImage(e);
- var t = Math.floor(e.pageY - (this.glassSize/2));
- var l = Math.floor(e.pageX - (this.glassSize/2));
- dojo.style(this.glassNode,"top",t);
- dojo.style(this.glassNode,"left",l);
-
- },
-
- _setImage: function(e){
- // summary: set the image's offset in the clipping window relative to the mouse position
-
- var xOff = (e.pageX - this.offset.l) / this.offset.w;
- var yOff = (e.pageY - this.offset.t) / this.offset.h;
- var x = (this._zoomSize.w * xOff * -1)+(this.glassSize*xOff);
- var y = (this._zoomSize.h * yOff * -1)+(this.glassSize*yOff);
- with(this.img.style){
- top = y+"px";
- left = x+"px";
- }
-
- }
-
-});
-
-}