Fix cursor feedback for file drag-in on Linux, where we can set it

This commit is contained in:
Dan Stillman 2013-09-03 04:49:02 -04:00
parent 82769f0b9c
commit 6eb354bf36
2 changed files with 24 additions and 37 deletions

View File

@ -1782,14 +1782,21 @@ Zotero.CollectionTreeView.prototype.onDragOver = function (event) {
// - Setting the dropEffect only works on Linux and OS X.
//
// - Modifier keys don't show up in the drag event on OS X until the
// drop, so since we can't show a correct effect, we leave it at
// the default 'move', the least misleading option.
// drop (https://bugzilla.mozilla.org/show_bug.cgi?id=911918),
// so since we can't show a correct effect, we leave it at
// the default 'move', the least misleading option, and set it
// below in onDrop().
//
// - The cursor effect gets set by the system on Windows 7 and can't
// be overridden.
if (!Zotero.isMac) {
if (event.ctrlKey && event.shiftKey) {
event.dataTransfer.dropEffect = "link";
if (event.shiftKey) {
if (event.ctrlKey) {
event.dataTransfer.dropEffect = "link";
}
else {
event.dataTransfer.dropEffect = "move";
}
}
else {
event.dataTransfer.dropEffect = "copy";
@ -1809,9 +1816,8 @@ Zotero.CollectionTreeView.prototype.onDragOver = function (event) {
*/
Zotero.CollectionTreeView.prototype.onDrop = function (event) {
if (event.dataTransfer.types.contains("application/x-moz-file")) {
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
Zotero.safeDebug(event);
if (Zotero.isMac) {
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
if (event.metaKey) {
if (event.altKey) {
event.dataTransfer.dropEffect = 'link';
@ -1824,19 +1830,6 @@ Zotero.CollectionTreeView.prototype.onDrop = function (event) {
event.dataTransfer.dropEffect = 'copy';
}
}
else {
if (event.shiftKey) {
if (event.ctrlKey) {
event.dataTransfer.dropEffect = "link";
}
else {
event.dataTransfer.dropEffect = "move";
}
}
else {
event.dataTransfer.dropEffect = "copy";
}
}
}
return false;
}

View File

@ -3062,14 +3062,21 @@ Zotero.ItemTreeView.prototype.onDragOver = function (event) {
// - Setting the dropEffect only works on Linux and OS X.
//
// - Modifier keys don't show up in the drag event on OS X until the
// drop, so since we can't show a correct effect, we leave it at
// the default 'move', the least misleading option.
// drop (https://bugzilla.mozilla.org/show_bug.cgi?id=911918),
// so since we can't show a correct effect, we leave it at
// the default 'move', the least misleading option, and set it
// below in onDrop().
//
// - The cursor effect gets set by the system on Windows 7 and can't
// be overridden.
if (!Zotero.isMac) {
if (event.ctrlKey && event.shiftKey) {
event.dataTransfer.dropEffect = "link";
if (event.shiftKey) {
if (event.ctrlKey) {
event.dataTransfer.dropEffect = "link";
}
else {
event.dataTransfer.dropEffect = "move";
}
}
else {
event.dataTransfer.dropEffect = "copy";
@ -3089,8 +3096,8 @@ Zotero.ItemTreeView.prototype.onDragOver = function (event) {
*/
Zotero.ItemTreeView.prototype.onDrop = function (event) {
if (event.dataTransfer.types.contains("application/x-moz-file")) {
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
if (Zotero.isMac) {
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
if (event.metaKey) {
if (event.altKey) {
event.dataTransfer.dropEffect = 'link';
@ -3103,19 +3110,6 @@ Zotero.ItemTreeView.prototype.onDrop = function (event) {
event.dataTransfer.dropEffect = 'copy';
}
}
else {
if (event.shiftKey) {
if (event.ctrlKey) {
event.dataTransfer.dropEffect = "link";
}
else {
event.dataTransfer.dropEffect = "move";
}
}
else {
event.dataTransfer.dropEffect = "copy";
}
}
}
return false;
}