Mercurial > hg > webaudioevaluationtool
changeset 3057:05fa3ce95015
Merge branch 'vnext' into Dev_main
# Conflicts:
# interfaces/ordinal.js
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Tue, 31 Oct 2017 10:55:09 +0000 |
parents | 95af70fef794 (current diff) c5f5e2196a82 (diff) |
children | 01ca365f350d |
files | interfaces/ordinal.js |
diffstat | 1 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/interfaces/ordinal.js Tue Oct 31 10:00:19 2017 +0000 +++ b/interfaces/ordinal.js Tue Oct 31 10:55:09 2017 +0000 @@ -222,7 +222,6 @@ 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,8 +251,8 @@ e.currentTarget.classList.add("dragging"); e.dataTransfer.effectAllowed = 'move'; - e.dataTransfer.setData('text/plain', audioObject.id); - this.dragging = "true"; + e.dataTransfer.setData('text/plain', String(audioObject.id)); + sessionStorage.setItem("drag-object", String(audioObject.id)); } function dragEnter(e) { @@ -269,10 +268,17 @@ if (e.preventDefault) { e.preventDefault(); // Necessary. Allows us to drop. } + e.dataTransfer.dropEffect = 'move'; // See the section on the DataTransfer object. + var srcid = e.dataTransfer.getData('text/plain'); + if (srcid == "") { + srcid = sessionStorage.getItem("drag-object"); + } + console.log(srcid); + var srcid = Number(srcid); var elements = container.childNodes; var srcObject = audioEngineContext.audioObjects.find(function (ao) { - return ao.interfaceDOM.dragging; + return ao.id === srcid; }); var src = srcObject.interfaceDOM.root; if (src !== root) { @@ -292,6 +298,8 @@ } } + + return false; } function drop(e) { @@ -308,6 +316,8 @@ ao.interfaceDOM.processMovement(); }); + sessionStorage.removeItem("drag-object"); + return false; } @@ -315,7 +325,6 @@ // this/e.target is the source node. $(".ordinal-element").removeClass("dragging"); $(".ordinal-element").removeClass("over"); - this.dragging = false; } this.getElementPosition = function () { @@ -422,9 +431,6 @@ if (interfaceContext.checkHiddenReference() === false) { return; } - if (interfaceContext.checkCommentQuestions() === false) { - return; - } for (var i = 0; i < checks.length; i++) { var checkState = true;