changeset 3000:18784c9f44b5

#141 Fixed ordinal evaluation in Chrome. Chrome does not correctly handle the dataTransfer objects.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Wed, 02 Aug 2017 11:43:56 +0100
parents 81835c995abd
children a4fb0d21570a
files interfaces/ordinal.js
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/interfaces/ordinal.js	Wed Aug 02 10:59:45 2017 +0100
+++ b/interfaces/ordinal.js	Wed Aug 02 11:43:56 2017 +0100
@@ -222,6 +222,7 @@
     root.addEventListener('dragleave', this, true);
     root.addEventListener('drop', this, true);
     root.addEventListener('dragend', this, true);
+    this.dragging = false;
     this.handleEvent = function (event) {
         if (event.type == "click") {
             if (playing === false) {
@@ -252,6 +253,7 @@
 
         e.dataTransfer.effectAllowed = 'move';
         e.dataTransfer.setData('text/plain', audioObject.id);
+        this.dragging = "true";
     }
 
     function dragEnter(e) {
@@ -267,13 +269,10 @@
         if (e.preventDefault) {
             e.preventDefault(); // Necessary. Allows us to drop.
         }
-
         e.dataTransfer.dropEffect = 'move'; // See the section on the DataTransfer object.
-
-        var srcid = Number(e.dataTransfer.getData("text/plain"));
         var elements = container.childNodes;
         var srcObject = audioEngineContext.audioObjects.find(function (ao) {
-            return ao.id === srcid;
+            return ao.interfaceDOM.dragging;
         });
         var src = srcObject.interfaceDOM.root;
         if (src !== root) {
@@ -293,8 +292,6 @@
             }
 
         }
-
-        return false;
     }
 
     function drop(e) {
@@ -318,6 +315,7 @@
         // this/e.target is the source node.
         $(".ordinal-element").removeClass("dragging");
         $(".ordinal-element").removeClass("over");
+        this.dragging = false;
     }
 
     this.getElementPosition = function () {