Skip to content
Permalink
Browse files

Added platform cursors

  • Loading branch information
rdworth committed May 26, 2008
1 parent 1829627 commit a1ca614a88c6f9719b5cced75cd84965e857e1d6
Showing with 41 additions and 13 deletions.
  1. +41 −13 ui/tests/autodrag.html
  2. BIN ui/tests/cursors/linux/auto.png
  3. BIN ui/tests/cursors/linux/crosshair.png
  4. BIN ui/tests/cursors/linux/default.png
  5. BIN ui/tests/cursors/linux/e-resize.png
  6. BIN ui/tests/cursors/linux/help.png
  7. BIN ui/tests/cursors/linux/move.png
  8. BIN ui/tests/cursors/linux/n-resize.png
  9. BIN ui/tests/cursors/linux/ne-resize.png
  10. BIN ui/tests/{images/blank.cur → cursors/linux/none.cur}
  11. BIN ui/tests/cursors/linux/none.png
  12. BIN ui/tests/cursors/linux/nw-resize.png
  13. BIN ui/tests/cursors/linux/pointer.png
  14. BIN ui/tests/cursors/linux/s-resize.png
  15. BIN ui/tests/cursors/linux/se-resize.png
  16. BIN ui/tests/cursors/linux/sw-resize.png
  17. BIN ui/tests/cursors/linux/text.png
  18. BIN ui/tests/cursors/linux/w-resize.png
  19. BIN ui/tests/cursors/mac/auto.png
  20. BIN ui/tests/cursors/mac/crosshair.png
  21. BIN ui/tests/cursors/mac/default.png
  22. BIN ui/tests/cursors/mac/e-resize.png
  23. BIN ui/tests/cursors/mac/help.png
  24. BIN ui/tests/cursors/mac/move.png
  25. BIN ui/tests/cursors/mac/n-resize.png
  26. BIN ui/tests/cursors/mac/ne-resize.png
  27. BIN ui/tests/cursors/mac/none.cur
  28. BIN ui/tests/cursors/mac/none.png
  29. BIN ui/tests/cursors/mac/nw-resize.png
  30. BIN ui/tests/cursors/mac/pointer.png
  31. BIN ui/tests/cursors/mac/s-resize.png
  32. BIN ui/tests/cursors/mac/se-resize.png
  33. BIN ui/tests/cursors/mac/sw-resize.png
  34. BIN ui/tests/cursors/mac/text.png
  35. BIN ui/tests/cursors/mac/w-resize.png
  36. BIN ui/tests/cursors/win/auto.png
  37. BIN ui/tests/cursors/win/crosshair.png
  38. BIN ui/tests/cursors/win/default.png
  39. BIN ui/tests/cursors/win/e-resize.png
  40. BIN ui/tests/cursors/win/help.png
  41. BIN ui/tests/cursors/win/move.png
  42. BIN ui/tests/cursors/win/n-resize.png
  43. BIN ui/tests/cursors/win/ne-resize.png
  44. BIN ui/tests/cursors/win/none.cur
  45. BIN ui/tests/cursors/win/none.png
  46. BIN ui/tests/cursors/win/nw-resize.png
  47. BIN ui/tests/cursors/win/pointer.png
  48. BIN ui/tests/cursors/win/s-resize.png
  49. BIN ui/tests/cursors/win/se-resize.png
  50. BIN ui/tests/cursors/win/sw-resize.png
  51. BIN ui/tests/cursors/win/text.png
  52. BIN ui/tests/cursors/win/w-resize.png
  53. BIN ui/tests/images/se-resize.png
@@ -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 @@
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 @@
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();
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.

0 comments on commit a1ca614

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