Added platform cursors
@ -8,9 +8,9 @@
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
html, body { height: 100%; }
|
||||
html, body { height: 95%; }
|
||||
#main { height: 100%; }
|
||||
#drag { width: 200px; height: 200px; background: #eef; }
|
||||
#drag { cursor: move; width: 200px; height: 200px; background: #eef; }
|
||||
|
||||
</style>
|
||||
|
||||
@ -74,25 +74,50 @@ function draggableTest(el, dx, dy) {
|
||||
var left = center.x;
|
||||
var top = center.y;
|
||||
|
||||
var fakemouse = $('<img src="images/cursor.png" id="fakemouse"/>');
|
||||
var realmouse = $('<img src="images/cursor.png" id="realmouse"/>');
|
||||
var OS = (/(win|mac|linux)/i.exec(navigator.platform) || ['other'])[0].toLowerCase();
|
||||
|
||||
var defaultUrl = ['cursors', OS == 'other' ? 'win' : OS, 'default.png'].join('/');
|
||||
var cursorUrl = function() {
|
||||
return ['cursors', OS == 'other' ? 'win' : OS, $(el).css('cursor') + '.png'].join('/');
|
||||
}
|
||||
var noneUrl = ['cursors', OS == 'other' ? 'win' : OS, 'none.cur'].join('/');
|
||||
|
||||
var fakemouse = $('<img src="' + defaultUrl + '" id="fakemouse" />');
|
||||
var realmouse = $('<img src="' + defaultUrl + '" id="realmouse" />');
|
||||
if ($.browser.msie && $.browser.version == 6) {
|
||||
fakemouse = $('<div id="fakemouse" style="height:23;width:16;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'images/cursor.png\', sizingMethod=\'scale\');" ></div>');
|
||||
realmouse = $('<div><div id="realmouse" style="height:23;width:16;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'images/cursor.png\', sizingMethod=\'scale\');" ></div></div>');
|
||||
fakemouse = $('<div id="fakemouse" style="height:32;width:32;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\');" ></div>');
|
||||
realmouse = $('<div><div id="realmouse" style="height:32;width:32;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\');" ></div></div>');
|
||||
}
|
||||
var mousescreen = $('<div id="mousescreen"/>');
|
||||
|
||||
var updateCursor = function() {
|
||||
if ($.browser.msie && $.browser.version == 6) {
|
||||
fakemouse.css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + cursorUrl() + '\', sizingMethod=\'scale\'');
|
||||
} else {
|
||||
fakemouse.attr('src', cursorUrl());
|
||||
}
|
||||
}
|
||||
var resetCursor = function() {
|
||||
if ($.browser.msie && $.browser.version == 6) {
|
||||
fakemouse.css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\'');
|
||||
} else {
|
||||
fakemouse.attr('src', defaultUrl);
|
||||
}
|
||||
}
|
||||
|
||||
var testStart = function() {
|
||||
$(el).bind("mouseover", updateCursor).bind("mouseout", resetCursor);
|
||||
fakemouse.appendTo('body').css({ position: 'absolute', left: mouseX, top: mouseY, zIndex: 5000 });
|
||||
realmouse.appendTo('body').css({ position: 'absolute', left: mouseX, top: mouseY, zIndex: 5000, opacity: 0.1 })
|
||||
.mousedown(function() { return false; });
|
||||
realmouse.appendTo('body').css({ position: 'absolute', left: mouseX, top: 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; })
|
||||
.mousedown(function() { return false; })
|
||||
.mouseup(function() { return false; });
|
||||
(!$.browser.safari && mousescreen.css({ cursor: 'url(images/blank.cur), auto' }));
|
||||
mousescreen.css('cursor', 'url(' + noneUrl + '), crosshair');
|
||||
(($.browser.safari || $.browser.opera) && mousescreen.css('cursor', 'crosshair'));
|
||||
}
|
||||
var testStop = function() {
|
||||
$(el).unbind("mouseover", updateCursor).unbind("mouseout", resetCursor);
|
||||
mousescreen.remove();
|
||||
mouseX = realmouse.css("left");
|
||||
mouseY = realmouse.css("top");
|
||||
@ -105,25 +130,28 @@ function draggableTest(el, dx, dy) {
|
||||
var lastX = null;
|
||||
|
||||
fakemouse
|
||||
.animate({ left: left, top: top }, "fast", function() {
|
||||
.animate({ left: left, top: top }, "slow", function() {
|
||||
$(el).triggerHandler('mouseover');
|
||||
testMouseDown(el, left, top);
|
||||
testMouseMove(el, left, top);
|
||||
})
|
||||
.animate({ left: left + dx, top: top + dy }, {
|
||||
speed: "fast",
|
||||
speed: "slow",
|
||||
easing: "swing",
|
||||
step: function (xory) {
|
||||
if (!lastX) {
|
||||
lastX = xory;
|
||||
} else {
|
||||
testMouseMove(el, lastX, xory);
|
||||
var x = lastX, y = xory;
|
||||
testMouseMove(el, x, y);
|
||||
lastX = null;
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$(el).triggerHandler('mouseout');
|
||||
testMouseUp(el, 0, 0);
|
||||
$(this).animate({ left: realmouse.css("left"), top: realmouse.css("top") }, {
|
||||
speed: "fast",
|
||||
speed: "slow",
|
||||
complete: function() {
|
||||
testStop();
|
||||
}
|
||||
|
BIN
ui/tests/cursors/linux/auto.png
Normal file
After Width: | Height: | Size: 851 B |
BIN
ui/tests/cursors/linux/crosshair.png
Normal file
After Width: | Height: | Size: 413 B |
BIN
ui/tests/cursors/linux/default.png
Normal file
After Width: | Height: | Size: 851 B |
BIN
ui/tests/cursors/linux/e-resize.png
Normal file
After Width: | Height: | Size: 861 B |
BIN
ui/tests/cursors/linux/help.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
ui/tests/cursors/linux/move.png
Normal file
After Width: | Height: | Size: 710 B |
BIN
ui/tests/cursors/linux/n-resize.png
Normal file
After Width: | Height: | Size: 871 B |
BIN
ui/tests/cursors/linux/ne-resize.png
Normal file
After Width: | Height: | Size: 836 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
BIN
ui/tests/cursors/linux/none.png
Normal file
After Width: | Height: | Size: 872 B |
BIN
ui/tests/cursors/linux/nw-resize.png
Normal file
After Width: | Height: | Size: 824 B |
BIN
ui/tests/cursors/linux/pointer.png
Normal file
After Width: | Height: | Size: 541 B |
BIN
ui/tests/cursors/linux/s-resize.png
Normal file
After Width: | Height: | Size: 871 B |
BIN
ui/tests/cursors/linux/se-resize.png
Normal file
After Width: | Height: | Size: 824 B |
BIN
ui/tests/cursors/linux/sw-resize.png
Normal file
After Width: | Height: | Size: 836 B |
BIN
ui/tests/cursors/linux/text.png
Normal file
After Width: | Height: | Size: 486 B |
BIN
ui/tests/cursors/linux/w-resize.png
Normal file
After Width: | Height: | Size: 861 B |
BIN
ui/tests/cursors/mac/auto.png
Normal file
After Width: | Height: | Size: 401 B |
BIN
ui/tests/cursors/mac/crosshair.png
Normal file
After Width: | Height: | Size: 341 B |
BIN
ui/tests/cursors/mac/default.png
Normal file
After Width: | Height: | Size: 401 B |
BIN
ui/tests/cursors/mac/e-resize.png
Normal file
After Width: | Height: | Size: 390 B |
BIN
ui/tests/cursors/mac/help.png
Normal file
After Width: | Height: | Size: 689 B |
BIN
ui/tests/cursors/mac/move.png
Normal file
After Width: | Height: | Size: 651 B |
BIN
ui/tests/cursors/mac/n-resize.png
Normal file
After Width: | Height: | Size: 434 B |
BIN
ui/tests/cursors/mac/ne-resize.png
Normal file
After Width: | Height: | Size: 440 B |
BIN
ui/tests/cursors/mac/none.cur
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
ui/tests/cursors/mac/none.png
Normal file
After Width: | Height: | Size: 872 B |
BIN
ui/tests/cursors/mac/nw-resize.png
Normal file
After Width: | Height: | Size: 452 B |
BIN
ui/tests/cursors/mac/pointer.png
Normal file
After Width: | Height: | Size: 675 B |
BIN
ui/tests/cursors/mac/s-resize.png
Normal file
After Width: | Height: | Size: 434 B |
BIN
ui/tests/cursors/mac/se-resize.png
Normal file
After Width: | Height: | Size: 452 B |
BIN
ui/tests/cursors/mac/sw-resize.png
Normal file
After Width: | Height: | Size: 440 B |
BIN
ui/tests/cursors/mac/text.png
Normal file
After Width: | Height: | Size: 436 B |
BIN
ui/tests/cursors/mac/w-resize.png
Normal file
After Width: | Height: | Size: 390 B |
BIN
ui/tests/cursors/win/auto.png
Normal file
After Width: | Height: | Size: 724 B |
BIN
ui/tests/cursors/win/crosshair.png
Normal file
After Width: | Height: | Size: 304 B |
BIN
ui/tests/cursors/win/default.png
Normal file
After Width: | Height: | Size: 724 B |
BIN
ui/tests/cursors/win/e-resize.png
Normal file
After Width: | Height: | Size: 714 B |
BIN
ui/tests/cursors/win/help.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
ui/tests/cursors/win/move.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
ui/tests/cursors/win/n-resize.png
Normal file
After Width: | Height: | Size: 722 B |
BIN
ui/tests/cursors/win/ne-resize.png
Normal file
After Width: | Height: | Size: 985 B |
BIN
ui/tests/cursors/win/none.cur
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
ui/tests/cursors/win/none.png
Normal file
After Width: | Height: | Size: 872 B |
BIN
ui/tests/cursors/win/nw-resize.png
Normal file
After Width: | Height: | Size: 993 B |
BIN
ui/tests/cursors/win/pointer.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
ui/tests/cursors/win/s-resize.png
Normal file
After Width: | Height: | Size: 722 B |
BIN
ui/tests/cursors/win/se-resize.png
Normal file
After Width: | Height: | Size: 993 B |
BIN
ui/tests/cursors/win/sw-resize.png
Normal file
After Width: | Height: | Size: 985 B |
BIN
ui/tests/cursors/win/text.png
Normal file
After Width: | Height: | Size: 258 B |
BIN
ui/tests/cursors/win/w-resize.png
Normal file
After Width: | Height: | Size: 714 B |
Before Width: | Height: | Size: 2.8 KiB |