]> source.dussan.org Git - jquery-ui.git/commitdiff
Added platform cursors
authorRichard Worth <rdworth@gmail.com>
Mon, 26 May 2008 10:18:11 +0000 (10:18 +0000)
committerRichard Worth <rdworth@gmail.com>
Mon, 26 May 2008 10:18:11 +0000 (10:18 +0000)
54 files changed:
ui/tests/autodrag.html
ui/tests/cursors/linux/auto.png [new file with mode: 0644]
ui/tests/cursors/linux/crosshair.png [new file with mode: 0644]
ui/tests/cursors/linux/default.png [new file with mode: 0644]
ui/tests/cursors/linux/e-resize.png [new file with mode: 0644]
ui/tests/cursors/linux/help.png [new file with mode: 0644]
ui/tests/cursors/linux/move.png [new file with mode: 0644]
ui/tests/cursors/linux/n-resize.png [new file with mode: 0644]
ui/tests/cursors/linux/ne-resize.png [new file with mode: 0644]
ui/tests/cursors/linux/none.cur [new file with mode: 0644]
ui/tests/cursors/linux/none.png [new file with mode: 0644]
ui/tests/cursors/linux/nw-resize.png [new file with mode: 0644]
ui/tests/cursors/linux/pointer.png [new file with mode: 0644]
ui/tests/cursors/linux/s-resize.png [new file with mode: 0644]
ui/tests/cursors/linux/se-resize.png [new file with mode: 0644]
ui/tests/cursors/linux/sw-resize.png [new file with mode: 0644]
ui/tests/cursors/linux/text.png [new file with mode: 0644]
ui/tests/cursors/linux/w-resize.png [new file with mode: 0644]
ui/tests/cursors/mac/auto.png [new file with mode: 0644]
ui/tests/cursors/mac/crosshair.png [new file with mode: 0644]
ui/tests/cursors/mac/default.png [new file with mode: 0644]
ui/tests/cursors/mac/e-resize.png [new file with mode: 0644]
ui/tests/cursors/mac/help.png [new file with mode: 0644]
ui/tests/cursors/mac/move.png [new file with mode: 0644]
ui/tests/cursors/mac/n-resize.png [new file with mode: 0644]
ui/tests/cursors/mac/ne-resize.png [new file with mode: 0644]
ui/tests/cursors/mac/none.cur [new file with mode: 0644]
ui/tests/cursors/mac/none.png [new file with mode: 0644]
ui/tests/cursors/mac/nw-resize.png [new file with mode: 0644]
ui/tests/cursors/mac/pointer.png [new file with mode: 0644]
ui/tests/cursors/mac/s-resize.png [new file with mode: 0644]
ui/tests/cursors/mac/se-resize.png [new file with mode: 0644]
ui/tests/cursors/mac/sw-resize.png [new file with mode: 0644]
ui/tests/cursors/mac/text.png [new file with mode: 0644]
ui/tests/cursors/mac/w-resize.png [new file with mode: 0644]
ui/tests/cursors/win/auto.png [new file with mode: 0644]
ui/tests/cursors/win/crosshair.png [new file with mode: 0644]
ui/tests/cursors/win/default.png [new file with mode: 0644]
ui/tests/cursors/win/e-resize.png [new file with mode: 0644]
ui/tests/cursors/win/help.png [new file with mode: 0644]
ui/tests/cursors/win/move.png [new file with mode: 0644]
ui/tests/cursors/win/n-resize.png [new file with mode: 0644]
ui/tests/cursors/win/ne-resize.png [new file with mode: 0644]
ui/tests/cursors/win/none.cur [new file with mode: 0644]
ui/tests/cursors/win/none.png [new file with mode: 0644]
ui/tests/cursors/win/nw-resize.png [new file with mode: 0644]
ui/tests/cursors/win/pointer.png [new file with mode: 0644]
ui/tests/cursors/win/s-resize.png [new file with mode: 0644]
ui/tests/cursors/win/se-resize.png [new file with mode: 0644]
ui/tests/cursors/win/sw-resize.png [new file with mode: 0644]
ui/tests/cursors/win/text.png [new file with mode: 0644]
ui/tests/cursors/win/w-resize.png [new file with mode: 0644]
ui/tests/images/blank.cur [deleted file]
ui/tests/images/se-resize.png [deleted file]

index 05cbefd994b21328031bb2222702140c8bb6ea9d..78caac169212fdef7d0b5b2d40443b20363dcddc 100644 (file)
@@ -8,9 +8,9 @@
 \r
 <style type="text/css">\r
 \r
-html, body { height: 100%; }\r
+html, body { height: 95%; }\r
 #main { height: 100%; }\r
-#drag { width: 200px; height: 200px; background: #eef; }\r
+#drag { cursor: move; width: 200px; height: 200px; background: #eef; }\r
 \r
 </style>\r
 \r
@@ -74,25 +74,50 @@ function draggableTest(el, dx, dy) {
        var left = center.x;\r
        var top = center.y;\r
 \r
-       var fakemouse = $('<img src="images/cursor.png" id="fakemouse"/>');\r
-       var realmouse = $('<img src="images/cursor.png" id="realmouse"/>');\r
+       var OS = (/(win|mac|linux)/i.exec(navigator.platform) || ['other'])[0].toLowerCase();\r
+\r
+       var defaultUrl = ['cursors', OS == 'other' ? 'win' : OS, 'default.png'].join('/');\r
+       var cursorUrl = function() {\r
+               return ['cursors', OS == 'other' ? 'win' : OS, $(el).css('cursor') + '.png'].join('/');\r
+       }\r
+       var noneUrl = ['cursors', OS == 'other' ? 'win' : OS, 'none.cur'].join('/');\r
+\r
+       var fakemouse = $('<img src="' + defaultUrl + '" id="fakemouse" />');\r
+       var realmouse = $('<img src="' + defaultUrl + '" id="realmouse" />');\r
        if ($.browser.msie && $.browser.version == 6) {\r
-               fakemouse = $('<div id="fakemouse" style="height:23;width:16;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'images/cursor.png\', sizingMethod=\'scale\');" ></div>');\r
-               realmouse = $('<div><div id="realmouse" style="height:23;width:16;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'images/cursor.png\', sizingMethod=\'scale\');" ></div></div>');\r
+               fakemouse = $('<div id="fakemouse" style="height:32;width:32;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\');" ></div>');\r
+               realmouse = $('<div><div id="realmouse" style="height:32;width:32;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\');" ></div></div>');\r
        }\r
        var mousescreen = $('<div id="mousescreen"/>');\r
+\r
+       var updateCursor = function() {\r
+               if ($.browser.msie && $.browser.version == 6) {\r
+                       fakemouse.css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + cursorUrl() + '\', sizingMethod=\'scale\'');\r
+               } else {\r
+                       fakemouse.attr('src', cursorUrl());\r
+               }\r
+       }\r
+       var resetCursor = function() {\r
+               if ($.browser.msie && $.browser.version == 6) {\r
+                       fakemouse.css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\'');\r
+               } else {\r
+                       fakemouse.attr('src', defaultUrl);\r
+               }\r
+       }\r
        \r
        var testStart = function() {\r
+               $(el).bind("mouseover", updateCursor).bind("mouseout", resetCursor);\r
                fakemouse.appendTo('body').css({ position: 'absolute', left: mouseX, top: mouseY, zIndex: 5000 });\r
-               realmouse.appendTo('body').css({ position: 'absolute', left: mouseX, top: mouseY, zIndex: 5000, opacity: 0.1 })\r
-                       .mousedown(function() { return false; });\r
+               realmouse.appendTo('body').css({ position: 'absolute', left: mouseX, top: mouseY, zIndex: 5000, opacity: 0.1 });\r
                mousescreen.appendTo('body').css({ width: '100%', height: '100%', position: 'absolute', top: 0, left: 0, zIndex: 5000 })\r
                        .mousemove(function(e) { realmouse.css({ left: e.pageX, top: e.pageY }); return false; })\r
                        .mousedown(function() { return false; })\r
                        .mouseup(function() { return false; });\r
-               (!$.browser.safari && mousescreen.css({ cursor: 'url(images/blank.cur), auto' }));\r
+               mousescreen.css('cursor', 'url(' + noneUrl + '), crosshair');\r
+               (($.browser.safari || $.browser.opera) && mousescreen.css('cursor', 'crosshair'));\r
        }\r
        var testStop = function() {\r
+               $(el).unbind("mouseover", updateCursor).unbind("mouseout", resetCursor);\r
                mousescreen.remove();\r
                mouseX = realmouse.css("left");\r
                mouseY = realmouse.css("top");\r
@@ -105,25 +130,28 @@ function draggableTest(el, dx, dy) {
        var lastX = null;\r
 \r
        fakemouse\r
-               .animate({ left: left, top: top }, "fast", function() {\r
+               .animate({ left: left, top: top }, "slow", function() {\r
+                       $(el).triggerHandler('mouseover');\r
                        testMouseDown(el, left, top);\r
                        testMouseMove(el, left, top);\r
                })\r
                .animate({ left: left + dx, top: top + dy }, {\r
-                       speed: "fast",\r
+                       speed: "slow",\r
                        easing: "swing",\r
                        step: function (xory) {\r
                                if (!lastX) {\r
                                        lastX = xory;\r
                                } else {\r
-                                       testMouseMove(el, lastX, xory);\r
+                                       var x = lastX, y = xory;\r
+                                       testMouseMove(el, x, y);\r
                                        lastX = null;\r
                                }\r
                        },\r
                        complete: function() {\r
+                               $(el).triggerHandler('mouseout');\r
                                testMouseUp(el, 0, 0);\r
                                $(this).animate({ left: realmouse.css("left"), top: realmouse.css("top") }, {\r
-                                       speed: "fast",\r
+                                       speed: "slow",\r
                                        complete: function() {\r
                                                testStop();\r
                                        }\r
diff --git a/ui/tests/cursors/linux/auto.png b/ui/tests/cursors/linux/auto.png
new file mode 100644 (file)
index 0000000..03ac2f2
Binary files /dev/null and b/ui/tests/cursors/linux/auto.png differ
diff --git a/ui/tests/cursors/linux/crosshair.png b/ui/tests/cursors/linux/crosshair.png
new file mode 100644 (file)
index 0000000..30904f9
Binary files /dev/null and b/ui/tests/cursors/linux/crosshair.png differ
diff --git a/ui/tests/cursors/linux/default.png b/ui/tests/cursors/linux/default.png
new file mode 100644 (file)
index 0000000..03ac2f2
Binary files /dev/null and b/ui/tests/cursors/linux/default.png differ
diff --git a/ui/tests/cursors/linux/e-resize.png b/ui/tests/cursors/linux/e-resize.png
new file mode 100644 (file)
index 0000000..b4c40ff
Binary files /dev/null and b/ui/tests/cursors/linux/e-resize.png differ
diff --git a/ui/tests/cursors/linux/help.png b/ui/tests/cursors/linux/help.png
new file mode 100644 (file)
index 0000000..a6b5836
Binary files /dev/null and b/ui/tests/cursors/linux/help.png differ
diff --git a/ui/tests/cursors/linux/move.png b/ui/tests/cursors/linux/move.png
new file mode 100644 (file)
index 0000000..39ae045
Binary files /dev/null and b/ui/tests/cursors/linux/move.png differ
diff --git a/ui/tests/cursors/linux/n-resize.png b/ui/tests/cursors/linux/n-resize.png
new file mode 100644 (file)
index 0000000..afef5b4
Binary files /dev/null and b/ui/tests/cursors/linux/n-resize.png differ
diff --git a/ui/tests/cursors/linux/ne-resize.png b/ui/tests/cursors/linux/ne-resize.png
new file mode 100644 (file)
index 0000000..8c5e970
Binary files /dev/null and b/ui/tests/cursors/linux/ne-resize.png differ
diff --git a/ui/tests/cursors/linux/none.cur b/ui/tests/cursors/linux/none.cur
new file mode 100644 (file)
index 0000000..4f7970a
Binary files /dev/null and b/ui/tests/cursors/linux/none.cur differ
diff --git a/ui/tests/cursors/linux/none.png b/ui/tests/cursors/linux/none.png
new file mode 100644 (file)
index 0000000..3b34811
Binary files /dev/null and b/ui/tests/cursors/linux/none.png differ
diff --git a/ui/tests/cursors/linux/nw-resize.png b/ui/tests/cursors/linux/nw-resize.png
new file mode 100644 (file)
index 0000000..7c17be5
Binary files /dev/null and b/ui/tests/cursors/linux/nw-resize.png differ
diff --git a/ui/tests/cursors/linux/pointer.png b/ui/tests/cursors/linux/pointer.png
new file mode 100644 (file)
index 0000000..b39fcef
Binary files /dev/null and b/ui/tests/cursors/linux/pointer.png differ
diff --git a/ui/tests/cursors/linux/s-resize.png b/ui/tests/cursors/linux/s-resize.png
new file mode 100644 (file)
index 0000000..afef5b4
Binary files /dev/null and b/ui/tests/cursors/linux/s-resize.png differ
diff --git a/ui/tests/cursors/linux/se-resize.png b/ui/tests/cursors/linux/se-resize.png
new file mode 100644 (file)
index 0000000..7c17be5
Binary files /dev/null and b/ui/tests/cursors/linux/se-resize.png differ
diff --git a/ui/tests/cursors/linux/sw-resize.png b/ui/tests/cursors/linux/sw-resize.png
new file mode 100644 (file)
index 0000000..8c5e970
Binary files /dev/null and b/ui/tests/cursors/linux/sw-resize.png differ
diff --git a/ui/tests/cursors/linux/text.png b/ui/tests/cursors/linux/text.png
new file mode 100644 (file)
index 0000000..85a54fc
Binary files /dev/null and b/ui/tests/cursors/linux/text.png differ
diff --git a/ui/tests/cursors/linux/w-resize.png b/ui/tests/cursors/linux/w-resize.png
new file mode 100644 (file)
index 0000000..b4c40ff
Binary files /dev/null and b/ui/tests/cursors/linux/w-resize.png differ
diff --git a/ui/tests/cursors/mac/auto.png b/ui/tests/cursors/mac/auto.png
new file mode 100644 (file)
index 0000000..65b21e4
Binary files /dev/null and b/ui/tests/cursors/mac/auto.png differ
diff --git a/ui/tests/cursors/mac/crosshair.png b/ui/tests/cursors/mac/crosshair.png
new file mode 100644 (file)
index 0000000..b4f165b
Binary files /dev/null and b/ui/tests/cursors/mac/crosshair.png differ
diff --git a/ui/tests/cursors/mac/default.png b/ui/tests/cursors/mac/default.png
new file mode 100644 (file)
index 0000000..65b21e4
Binary files /dev/null and b/ui/tests/cursors/mac/default.png differ
diff --git a/ui/tests/cursors/mac/e-resize.png b/ui/tests/cursors/mac/e-resize.png
new file mode 100644 (file)
index 0000000..583ce18
Binary files /dev/null and b/ui/tests/cursors/mac/e-resize.png differ
diff --git a/ui/tests/cursors/mac/help.png b/ui/tests/cursors/mac/help.png
new file mode 100644 (file)
index 0000000..5e8ee58
Binary files /dev/null and b/ui/tests/cursors/mac/help.png differ
diff --git a/ui/tests/cursors/mac/move.png b/ui/tests/cursors/mac/move.png
new file mode 100644 (file)
index 0000000..cf76085
Binary files /dev/null and b/ui/tests/cursors/mac/move.png differ
diff --git a/ui/tests/cursors/mac/n-resize.png b/ui/tests/cursors/mac/n-resize.png
new file mode 100644 (file)
index 0000000..1242980
Binary files /dev/null and b/ui/tests/cursors/mac/n-resize.png differ
diff --git a/ui/tests/cursors/mac/ne-resize.png b/ui/tests/cursors/mac/ne-resize.png
new file mode 100644 (file)
index 0000000..da3f6d0
Binary files /dev/null and b/ui/tests/cursors/mac/ne-resize.png differ
diff --git a/ui/tests/cursors/mac/none.cur b/ui/tests/cursors/mac/none.cur
new file mode 100644 (file)
index 0000000..4f7970a
Binary files /dev/null and b/ui/tests/cursors/mac/none.cur differ
diff --git a/ui/tests/cursors/mac/none.png b/ui/tests/cursors/mac/none.png
new file mode 100644 (file)
index 0000000..3b34811
Binary files /dev/null and b/ui/tests/cursors/mac/none.png differ
diff --git a/ui/tests/cursors/mac/nw-resize.png b/ui/tests/cursors/mac/nw-resize.png
new file mode 100644 (file)
index 0000000..b6c5e39
Binary files /dev/null and b/ui/tests/cursors/mac/nw-resize.png differ
diff --git a/ui/tests/cursors/mac/pointer.png b/ui/tests/cursors/mac/pointer.png
new file mode 100644 (file)
index 0000000..45fbd2b
Binary files /dev/null and b/ui/tests/cursors/mac/pointer.png differ
diff --git a/ui/tests/cursors/mac/s-resize.png b/ui/tests/cursors/mac/s-resize.png
new file mode 100644 (file)
index 0000000..1242980
Binary files /dev/null and b/ui/tests/cursors/mac/s-resize.png differ
diff --git a/ui/tests/cursors/mac/se-resize.png b/ui/tests/cursors/mac/se-resize.png
new file mode 100644 (file)
index 0000000..b6c5e39
Binary files /dev/null and b/ui/tests/cursors/mac/se-resize.png differ
diff --git a/ui/tests/cursors/mac/sw-resize.png b/ui/tests/cursors/mac/sw-resize.png
new file mode 100644 (file)
index 0000000..da3f6d0
Binary files /dev/null and b/ui/tests/cursors/mac/sw-resize.png differ
diff --git a/ui/tests/cursors/mac/text.png b/ui/tests/cursors/mac/text.png
new file mode 100644 (file)
index 0000000..2257903
Binary files /dev/null and b/ui/tests/cursors/mac/text.png differ
diff --git a/ui/tests/cursors/mac/w-resize.png b/ui/tests/cursors/mac/w-resize.png
new file mode 100644 (file)
index 0000000..583ce18
Binary files /dev/null and b/ui/tests/cursors/mac/w-resize.png differ
diff --git a/ui/tests/cursors/win/auto.png b/ui/tests/cursors/win/auto.png
new file mode 100644 (file)
index 0000000..b2c5c85
Binary files /dev/null and b/ui/tests/cursors/win/auto.png differ
diff --git a/ui/tests/cursors/win/crosshair.png b/ui/tests/cursors/win/crosshair.png
new file mode 100644 (file)
index 0000000..02c99b7
Binary files /dev/null and b/ui/tests/cursors/win/crosshair.png differ
diff --git a/ui/tests/cursors/win/default.png b/ui/tests/cursors/win/default.png
new file mode 100644 (file)
index 0000000..b2c5c85
Binary files /dev/null and b/ui/tests/cursors/win/default.png differ
diff --git a/ui/tests/cursors/win/e-resize.png b/ui/tests/cursors/win/e-resize.png
new file mode 100644 (file)
index 0000000..056eb69
Binary files /dev/null and b/ui/tests/cursors/win/e-resize.png differ
diff --git a/ui/tests/cursors/win/help.png b/ui/tests/cursors/win/help.png
new file mode 100644 (file)
index 0000000..b8034bb
Binary files /dev/null and b/ui/tests/cursors/win/help.png differ
diff --git a/ui/tests/cursors/win/move.png b/ui/tests/cursors/win/move.png
new file mode 100644 (file)
index 0000000..627e799
Binary files /dev/null and b/ui/tests/cursors/win/move.png differ
diff --git a/ui/tests/cursors/win/n-resize.png b/ui/tests/cursors/win/n-resize.png
new file mode 100644 (file)
index 0000000..d06244c
Binary files /dev/null and b/ui/tests/cursors/win/n-resize.png differ
diff --git a/ui/tests/cursors/win/ne-resize.png b/ui/tests/cursors/win/ne-resize.png
new file mode 100644 (file)
index 0000000..79f6c3a
Binary files /dev/null and b/ui/tests/cursors/win/ne-resize.png differ
diff --git a/ui/tests/cursors/win/none.cur b/ui/tests/cursors/win/none.cur
new file mode 100644 (file)
index 0000000..4f7970a
Binary files /dev/null and b/ui/tests/cursors/win/none.cur differ
diff --git a/ui/tests/cursors/win/none.png b/ui/tests/cursors/win/none.png
new file mode 100644 (file)
index 0000000..3b34811
Binary files /dev/null and b/ui/tests/cursors/win/none.png differ
diff --git a/ui/tests/cursors/win/nw-resize.png b/ui/tests/cursors/win/nw-resize.png
new file mode 100644 (file)
index 0000000..af48a12
Binary files /dev/null and b/ui/tests/cursors/win/nw-resize.png differ
diff --git a/ui/tests/cursors/win/pointer.png b/ui/tests/cursors/win/pointer.png
new file mode 100644 (file)
index 0000000..7d07182
Binary files /dev/null and b/ui/tests/cursors/win/pointer.png differ
diff --git a/ui/tests/cursors/win/s-resize.png b/ui/tests/cursors/win/s-resize.png
new file mode 100644 (file)
index 0000000..d06244c
Binary files /dev/null and b/ui/tests/cursors/win/s-resize.png differ
diff --git a/ui/tests/cursors/win/se-resize.png b/ui/tests/cursors/win/se-resize.png
new file mode 100644 (file)
index 0000000..af48a12
Binary files /dev/null and b/ui/tests/cursors/win/se-resize.png differ
diff --git a/ui/tests/cursors/win/sw-resize.png b/ui/tests/cursors/win/sw-resize.png
new file mode 100644 (file)
index 0000000..79f6c3a
Binary files /dev/null and b/ui/tests/cursors/win/sw-resize.png differ
diff --git a/ui/tests/cursors/win/text.png b/ui/tests/cursors/win/text.png
new file mode 100644 (file)
index 0000000..ce8dc22
Binary files /dev/null and b/ui/tests/cursors/win/text.png differ
diff --git a/ui/tests/cursors/win/w-resize.png b/ui/tests/cursors/win/w-resize.png
new file mode 100644 (file)
index 0000000..056eb69
Binary files /dev/null and b/ui/tests/cursors/win/w-resize.png differ
diff --git a/ui/tests/images/blank.cur b/ui/tests/images/blank.cur
deleted file mode 100644 (file)
index 4f7970a..0000000
Binary files a/ui/tests/images/blank.cur and /dev/null differ
diff --git a/ui/tests/images/se-resize.png b/ui/tests/images/se-resize.png
deleted file mode 100644 (file)
index ae636e4..0000000
Binary files a/ui/tests/images/se-resize.png and /dev/null differ