Commit 5457f35f by Valera Rozuvan Committed by Alexander Kryklia

Drag and Drop: Further testing of new feature "can reuse".

parent 7ad6ef21
......@@ -63,6 +63,8 @@ define(['logme', 'update_input'], function (logme, updateInput) {
var draggableObj, obj;
draggableObj = {
'uniqueId': /* this.uniqueId */ this.state.getUniqueId(), // Is newly set.
'originalConfigObj': this.originalConfigObj,
'stateDraggablesIndex': /* this.stateDraggablesIndex */ null, // Will be set.
......@@ -379,6 +381,8 @@ define(['logme', 'update_input'], function (logme, updateInput) {
var draggableObj;
draggableObj = {
'uniqueId': state.getUniqueId(),
'originalConfigObj': obj,
'stateDraggablesIndex': null,
......@@ -768,7 +772,7 @@ define(['logme', 'update_input'], function (logme, updateInput) {
if (
(this.state.config.onePerTarget === true) &&
(target.draggableList.length === 1) &&
(target.draggableList[0].id !== this.id)
(target.draggableList[0].uniqueId !== this.uniqueId)
) {
continue;
}
......
......@@ -26,9 +26,33 @@ define([], function () {
'targets': [],
'updateArrowOpacity': null
'updateArrowOpacity': null,
'uniqueId': 0,
'salt': makeSalt(),
'getUniqueId': getUniqueId
};
}
function getUniqueId() {
this.uniqueId += 1;
return this.salt + '_' + this.uniqueId.toFixed(0);
}
function makeSalt() {
var text, possible, i;
text = '';
possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for(i = 0; i < 5; i += 1) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}
});
// End of wrapper for RequireJS. As you can see, we are passing
......
......@@ -15,7 +15,7 @@ define(['logme'], function (logme) {
c1 += 1;
}
}(0));
} // function Targets(state) {
}
function processTarget(state, obj) {
var targetEl, borderCss, numTextEl, targetObj;
......@@ -36,7 +36,6 @@ define(['logme'], function (logme) {
'left: ' + obj.x + 'px; ' +
borderCss +
'" ' +
'data-target-id="' + obj.id + '" ' +
'></div>'
);
targetEl.appendTo(state.baseImageEl.parent());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment