Skip to content
Permalink
Browse files

No commit message

  • Loading branch information
rdworth committed May 26, 2008
1 parent b6d16ac commit 02155d1457bf558d20c231b411f2dea53b7ad1b1
Showing with 26 additions and 26 deletions.
  1. +26 −26 ui/tests/ui.testmouse.js
@@ -5,7 +5,7 @@
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Revision: $Id: $
* Revision: $Id:$
*/
;(function($) {

@@ -82,55 +82,55 @@
}
var noneUrl = ['cursors', OS == 'other' ? 'win' : OS, 'none' + ($.browser.safari ? '.png' : '.cur')].join('/');

var fakemouse = $('<img src="' + defaultUrl + '" />');
var realmouse = $('<img src="' + defaultUrl + '" />');
this.fakemouse = $('<img src="' + defaultUrl + '" />');
this.realmouse = $('<img src="' + defaultUrl + '" />');
if ($.browser.msie && $.browser.version == 6) {
fakemouse = $('<div style="height:32;width:32;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\');" ></div>');
realmouse = $('<div><div style="height:32;width:32;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\');" ></div></div>');
this.fakemouse = $('<div style="height:32;width:32;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\');" ></div>');
this.realmouse = $('<div><div style="height:32;width:32;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\');" ></div></div>');
}
var mousescreen = $('<div/>');
this.mousescreen = $('<div/>');

var updateCursor = function() {
this.updateCursor = function() {
if ($.browser.msie && $.browser.version == 6) {
fakemouse.css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + cursorUrl() + '\', sizingMethod=\'scale\'');
self.fakemouse.css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + cursorUrl() + '\', sizingMethod=\'scale\'');
} else {
fakemouse.attr('src', cursorUrl());
self.fakemouse.attr('src', cursorUrl());
}
}
var resetCursor = function() {
this.resetCursor = function() {
if ($.browser.msie && $.browser.version == 6) {
fakemouse.css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\'');
self.fakemouse.css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\'');
} else {
fakemouse.attr('src', defaultUrl);
self.fakemouse.attr('src', defaultUrl);
}
}

var testStart = function() {
self.element.bind("mouseover", updateCursor).bind("mouseout", resetCursor);
fakemouse.appendTo('body').css({ position: 'absolute', left: self.mouseX, top: self.mouseY, zIndex: 5000 });
realmouse.appendTo('body').css({ position: 'absolute', left: self.mouseX, top: self.mouseY, zIndex: 5000, opacity: 0.1 });
mousescreen.appendTo('body').css({ width: '100%', height: '100%', position: 'absolute', top: 0, left: 0, zIndex: 5000 })
.mousemove(function(e) { realmouse.css({ left: e.pageX, top: e.pageY }); return false; })
self.element.bind("mouseover", self.updateCursor).bind("mouseout", self.resetCursor);
self.fakemouse.appendTo('body').css({ position: 'absolute', left: self.mouseX, top: self.mouseY, zIndex: 5000 });
self.realmouse.appendTo('body').css({ position: 'absolute', left: self.mouseX, top: self.mouseY, zIndex: 5000, opacity: 0.1 });
self.mousescreen.appendTo('body').css({ width: '100%', height: '100%', position: 'absolute', top: 0, left: 0, zIndex: 5000 })
.mousemove(function(e) { self.realmouse.css({ left: e.pageX, top: e.pageY }); return false; })
.mousedown(function() { return false; })
.mouseup(function() { return false; });
mousescreen.css('cursor', 'url(' + noneUrl + '), crosshair');
self.mousescreen.css('cursor', 'url(' + noneUrl + '), crosshair');
($.browser.opera && mousescreen.css('cursor', 'crosshair'));
}
var testStop = function() {
self.element.unbind("mouseover", updateCursor).unbind("mouseout", resetCursor);
mousescreen.remove();
self.mouseX = realmouse.css("left");
self.mouseY = realmouse.css("top");
realmouse.remove();
fakemouse.remove();
self.element.unbind("mouseover", self.updateCursor).unbind("mouseout", self.resetCursor);
self.mousescreen.remove();
self.mouseX = self.realmouse.css("left");
self.mouseY = self.realmouse.css("top");
self.realmouse.remove();
self.fakemouse.remove();
($.isFunction(complete) && complete.apply());
}

testStart();

this.lastX = null;

fakemouse
this.fakemouse
.animate({ left: this.left, top: this.top }, this.options.speed, function() {
self.element.triggerHandler('mouseover');
self.down(self.left, self.top);
@@ -151,7 +151,7 @@
complete: function() {
self.element.triggerHandler('mouseout');
self.up(0, 0);
$(this).animate({ left: realmouse.css("left"), top: realmouse.css("top") }, {
$(this).animate({ left: self.realmouse.css("left"), top: self.realmouse.css("top") }, {
speed: self.options.speed,
complete: function() {
testStop();

0 comments on commit 02155d1

Please sign in to comment.
You can’t perform that action at this time.