Commit ead346ee by Valera Rozuvan Committed by Alexander Kryklia

Refactoring. New feature: adding multiple draggables from one.

parent e2bbaf08
......@@ -5,22 +5,32 @@
(function (requirejs, require, define) {
define(['logme', 'update_input'], function (logme, updateInput) {
return Draggables;
return {
'init': init
};
function Draggables(state) {
var c1;
function init(state) {
logme('Draggables.init; state = ', state);
state.draggables = [];
state.numDraggablesInSlider = 0;
state.currentMovingDraggable = null;
for (c1 = 0; c1 < state.config.draggables.length; c1 += 1) {
processDraggable(state.config.draggables[c1], c1 + 1);
(function (c1) {
while (c1 < state.config.draggables.length) {
processDraggable(state, state.config.draggables[c1], c1 + 1);
c1 += 1
}
}(0));
state.updateArrowOpacity();
state.currentMovingDraggable = null;
$(document).mousemove(function (event) {
documentMouseMove(state, event);
});
}
function documentMouseMove(state, event) {
if (state.currentMovingDraggable !== null) {
state.currentMovingDraggable.iconEl.css(
'left',
......@@ -53,18 +63,35 @@ define(['logme', 'update_input'], function (logme, updateInput) {
);
}
}
});
}
return;
function processDraggable(state, obj, objIndex) {
var draggableObj;
logme('processDraggable; state = ', state);
function processDraggable(obj, objIndex) {
var inContainer, mousePressed, onTarget, draggableObj;
logme('Processing draggable #' + objIndex);
draggableObj = {
'zIndex': objIndex,
'oldZIndex': objIndex,
'labelEl': null,
'hasLoaded': false
'hasLoaded': false,
'inContainer': true,
'mousePressed': false,
'onTarget': null,
'state': state,
'mouseDown': mouseDown,
'mouseUp': mouseUp,
'mouseMove': mouseMove,
'checkLandingElement': checkLandingElement,
'removeObjIdFromTarget': removeObjIdFromTarget,
'checkIfOnTarget': checkIfOnTarget,
'snapToTarget': snapToTarget,
'correctZIndexes': correctZIndexes,
'moveBackToSlider': moveBackToSlider
};
draggableObj.containerEl = $(
......@@ -169,9 +196,15 @@ define(['logme', 'update_input'], function (logme, updateInput) {
5 + draggableObj.iconHeightSmall + 5
);
draggableObj.labelEl.mousedown(mouseDown);
draggableObj.labelEl.mouseup(mouseUp);
draggableObj.labelEl.mousemove(mouseMove);
draggableObj.labelEl.mousedown(function (event) {
draggableObj.mouseDown.call(draggableObj, event);
});
draggableObj.labelEl.mouseup(function (event) {
draggableObj.mouseUp.call(draggableObj, event);
});
draggableObj.labelEl.mousemove(function (event) {
draggableObj.mouseMove.call(draggableObj, event);
});
}
draggableObj.hasLoaded = true;
......@@ -221,42 +254,41 @@ define(['logme', 'update_input'], function (logme, updateInput) {
}
}
draggableObj.iconEl.mousedown(mouseDown);
draggableObj.iconEl.mouseup(mouseUp);
draggableObj.iconEl.mousemove(mouseMove);
draggableObj.containerEl.mousedown(mouseDown);
draggableObj.containerEl.mouseup(mouseUp);
draggableObj.containerEl.mousemove(mouseMove);
inContainer = true;
mousePressed = false;
draggableObj.iconEl.mousedown(function (event) {
draggableObj.mouseDown.call(draggableObj, event);
});
draggableObj.iconEl.mouseup(function (event) {
draggableObj.mouseUp.call(draggableObj, event);
});
draggableObj.iconEl.mousemove(function (event) {
draggableObj.mouseMove.call(draggableObj, event);
});
onTarget = null;
draggableObj.containerEl.mousedown(function (event) {
draggableObj.mouseDown.call(draggableObj, event);
});
draggableObj.containerEl.mouseup(function (event) {
draggableObj.mouseUp.call(draggableObj, event);
});
draggableObj.containerEl.mousemove(function (event) {
draggableObj.mouseMove.call(draggableObj, event);
});
draggableObj.id = obj.id;
draggableObj.x = -1;
draggableObj.y = -1;
draggableObj.setInContainer = function (val) {
inContainer = val;
};
draggableObj.setOnTarget = function (val) {
onTarget = val;
};
state.draggables.push(draggableObj);
state.numDraggablesInSlider += 1;
if (obj.icon.length === 0) {
draggableObj.hasLoaded = true;
}
return;
state.draggables.push(draggableObj);
}
function mouseDown(event) {
if (mousePressed === false) {
if (this.mousePressed === false) {
// So that the browser does not perform a default drag.
// If we don't do this, each drag operation will
// potentially cause the highlghting of the dragged element.
......@@ -264,105 +296,105 @@ define(['logme', 'update_input'], function (logme, updateInput) {
// If this draggable is just being dragged out of the
// container, we must perform some additional tasks.
if (inContainer === true) {
draggableObj.containerEl.hide();
if (this.inContainer === true) {
this.containerEl.hide();
draggableObj.iconEl.detach();
draggableObj.iconEl.css(
'background-color', draggableObj.iconElBGColor
this.iconEl.detach();
this.iconEl.css(
'background-color', this.iconElBGColor
);
draggableObj.iconEl.css(
'padding-left', draggableObj.iconElPadding
this.iconEl.css(
'padding-left', this.iconElPadding
);
draggableObj.iconEl.css(
'padding-right', draggableObj.iconElPadding
this.iconEl.css(
'padding-right', this.iconElPadding
);
draggableObj.iconEl.css(
'border', draggableObj.iconElBorder
this.iconEl.css(
'border', this.iconElBorder
);
draggableObj.iconEl.css(
this.iconEl.css(
'width',
draggableObj.iconWidth
this.iconWidth
);
draggableObj.iconEl.css(
this.iconEl.css(
'height',
draggableObj.iconHeight
this.iconHeight
);
draggableObj.iconEl.css(
this.iconEl.css(
'left',
event.pageX -
state.baseImageEl.offset().left -
draggableObj.iconWidth * 0.5
- draggableObj.iconElLeftOffset
this.state.baseImageEl.offset().left -
this.iconWidth * 0.5
- this.iconElLeftOffset
);
draggableObj.iconEl.css(
this.iconEl.css(
'top',
event.pageY -
state.baseImageEl.offset().top -
draggableObj.iconHeight * 0.5
this.state.baseImageEl.offset().top -
this.iconHeight * 0.5
);
draggableObj.iconEl.appendTo(
this.iconEl.appendTo(
state.baseImageEl.parent()
);
if (draggableObj.labelEl !== null) {
draggableObj.labelEl.detach();
draggableObj.labelEl.css(
'background-color', state.config.labelBgColor
if (this.labelEl !== null) {
this.labelEl.detach();
this.labelEl.css(
'background-color', this.state.config.labelBgColor
);
draggableObj.labelEl.css(
this.labelEl.css(
'padding-left', 8
);
draggableObj.labelEl.css(
this.labelEl.css(
'padding-right', 8
);
draggableObj.labelEl.css(
this.labelEl.css(
'border', '1px solid black'
);
draggableObj.labelEl.css(
this.labelEl.css(
'left',
event.pageX -
state.baseImageEl.offset().left -
draggableObj.labelWidth * 0.5
this.state.baseImageEl.offset().left -
this.labelWidth * 0.5
- 9 // Account for padding, border.
);
draggableObj.labelEl.css(
this.labelEl.css(
'top',
event.pageY -
state.baseImageEl.offset().top +
draggableObj.iconHeight * 0.5 + 5
this.state.baseImageEl.offset().top +
this.iconHeight * 0.5 + 5
);
draggableObj.labelEl.appendTo(
state.baseImageEl.parent()
this.labelEl.appendTo(
this.state.baseImageEl.parent()
);
}
inContainer = false;
state.numDraggablesInSlider -= 1;
this.inContainer = false;
this.state.numDraggablesInSlider -= 1;
}
draggableObj.oldZIndex = draggableObj.zIndex;
draggableObj.zIndex = 1000;
draggableObj.iconEl.css('z-index', '1000');
if (draggableObj.labelEl !== null) {
draggableObj.labelEl.css('z-index', '1000');
this.oldZIndex = this.zIndex;
this.zIndex = 1000;
this.iconEl.css('z-index', '1000');
if (this.labelEl !== null) {
this.labelEl.css('z-index', '1000');
}
mousePressed = true;
state.currentMovingDraggable = draggableObj;
this.mousePressed = true;
this.state.currentMovingDraggable = this;
}
}
function mouseUp() {
if (mousePressed === true) {
state.currentMovingDraggable = null;
if (this.mousePressed === true) {
this.state.currentMovingDraggable = null;
checkLandingElement();
this.checkLandingElement();
}
}
function mouseMove() {
if (mousePressed === true) {
if (this.mousePressed === true) {
// Because we have also attached a 'mousemove' event to the
// 'document' (that will do the same thing), let's tell the
// browser not to bubble up this event. The attached event
......@@ -371,33 +403,33 @@ define(['logme', 'update_input'], function (logme, updateInput) {
// of a drag operation (user moves the mouse very quickly).
event.stopPropagation();
draggableObj.iconEl.css(
this.iconEl.css(
'left',
event.pageX -
state.baseImageEl.offset().left -
draggableObj.iconWidth * 0.5
- draggableObj.iconElLeftOffset
this.state.baseImageEl.offset().left -
this.iconWidth * 0.5
- this.iconElLeftOffset
);
draggableObj.iconEl.css(
this.iconEl.css(
'top',
event.pageY -
state.baseImageEl.offset().top -
draggableObj.iconHeight * 0.5
this.state.baseImageEl.offset().top -
this.iconHeight * 0.5
);
if (draggableObj.labelEl !== null) {
draggableObj.labelEl.css(
if (this.labelEl !== null) {
this.labelEl.css(
'left',
event.pageX -
state.baseImageEl.offset().left -
draggableObj.labelWidth * 0.5
this.state.baseImageEl.offset().left -
this.labelWidth * 0.5
- 9 // Acoount for padding, border.
);
draggableObj.labelEl.css(
this.labelEl.css(
'top',
event.pageY -
state.baseImageEl.offset().top +
draggableObj.iconHeight * 0.5 +
this.state.baseImageEl.offset().top +
this.iconHeight * 0.5 +
5
);
}
......@@ -410,75 +442,70 @@ define(['logme', 'update_input'], function (logme, updateInput) {
// the input with the user's answer (X-Y position of the draggable,
// or the ID of the target where it landed.
function checkLandingElement() {
var positionIE, targetFound;
var positionIE;
mousePressed = false;
positionIE = draggableObj.iconEl.position();
this.mousePressed = false;
positionIE = this.iconEl.position();
if (state.individualTargets === true) {
targetFound = false;
checkIfOnTarget();
if (targetFound === true) {
correctZIndexes();
if (this.state.individualTargets === true) {
if (this.checkIfOnTarget(positionIE) === true) {
this.correctZIndexes();
} else {
moveBackToSlider();
removeObjIdFromTarget();
this.moveBackToSlider();
this.removeObjIdFromTarget();
state.numDraggablesInSlider += 1;
this.state.numDraggablesInSlider += 1;
}
} else {
if (
(positionIE.left < 0) ||
(
positionIE.left + draggableObj.iconWidth >
state.baseImageEl.width()
positionIE.left + this.iconWidth >
this.state.baseImageEl.width()
) ||
(positionIE.top < 0) ||
(
positionIE.top + draggableObj.iconHeight >
state.baseImageEl.height()
positionIE.top + this.iconHeight >
this.state.baseImageEl.height()
)
) {
moveBackToSlider();
this.moveBackToSlider();
draggableObj.x = -1;
draggableObj.y = -1;
this.x = -1;
this.y = -1;
state.numDraggablesInSlider += 1;
this.state.numDraggablesInSlider += 1;
} else {
correctZIndexes();
this.correctZIndexes();
draggableObj.x =
positionIE.left + draggableObj.iconWidth * 0.5;
draggableObj.y =
positionIE.top + draggableObj.iconHeight * 0.5;
this.x =
positionIE.left + this.iconWidth * 0.5;
this.y =
positionIE.top + this.iconHeight * 0.5;
}
}
state.updateArrowOpacity();
updateInput(state);
return;
this.state.updateArrowOpacity();
updateInput(this.state);
}
function removeObjIdFromTarget() {
var c1;
if (onTarget !== null) {
for (c1 = 0; c1 < onTarget.draggable.length; c1 += 1) {
if (onTarget.draggable[c1] === draggableObj.id) {
onTarget.draggable.splice(c1, 1);
if (this.onTarget !== null) {
for (c1 = 0; c1 < this.onTarget.draggable.length; c1 += 1) {
if (this.onTarget.draggable[c1] === this.id) {
this.onTarget.draggable.splice(c1, 1);
break;
}
}
if (onTarget.numTextEl !== null) {
onTarget.updateNumTextEl();
if (this.onTarget.numTextEl !== null) {
this.onTarget.updateNumTextEl();
}
onTarget = null;
this.onTarget = null;
}
}
......@@ -490,22 +517,24 @@ define(['logme', 'update_input'], function (logme, updateInput) {
//
// positionIE is the object as returned by
//
// draggableObj.iconEl.position()
// this.iconEl.position()
//
function checkIfOnTarget() {
var c1, target;
function checkIfOnTarget(positionIE) {
var c1, target, targetFound;
for (c1 = 0; c1 < state.targets.length; c1 += 1) {
target = state.targets[c1];
targetFound = false;
for (c1 = 0; c1 < this.state.targets.length; c1 += 1) {
target = this.state.targets[c1];
// If only one draggable per target is allowed, and
// the current target already has a draggable on it
// (with an ID different from the one we are checking
// against), then go to next target.
if (
(state.config.one_per_target === true) &&
(this.state.config.one_per_target === true) &&
(target.draggable.length === 1) &&
(target.draggable[0] !== draggableObj.id)
(target.draggable[0] !== this.id)
) {
continue;
}
......@@ -513,25 +542,25 @@ define(['logme', 'update_input'], function (logme, updateInput) {
// Check if the draggable's center coordinate is within
// the target's dimensions. If not, go to next target.
if (
positionIE.top + draggableObj.iconHeight * 0.5 <
positionIE.top + this.iconHeight * 0.5 <
target.offset.top
) {
continue;
}
if (
positionIE.top + draggableObj.iconHeight * 0.5 >
positionIE.top + this.iconHeight * 0.5 >
target.offset.top + target.h
) {
continue;
}
if (
positionIE.left + draggableObj.iconWidth * 0.5 <
positionIE.left + this.iconWidth * 0.5 <
target.offset.left
) {
continue;
}
if (
positionIE.left + draggableObj.iconWidth * 0.5 >
positionIE.left + this.iconWidth * 0.5 >
target.offset.left + target.w
) {
continue;
......@@ -546,19 +575,19 @@ define(['logme', 'update_input'], function (logme, updateInput) {
// previous target's draggables list, and add it to the
// new target's draggables list.
if (
(onTarget !== null) &&
(onTarget.id !== target.id)
(this.onTarget !== null) &&
(this.onTarget.id !== target.id)
) {
removeObjIdFromTarget();
onTarget = target;
target.draggable.push(draggableObj.id);
this.removeObjIdFromTarget();
this.onTarget = target;
target.draggable.push(this.id);
}
// If the draggable was moved from the slider to a
// target, remember the target, and add ID to the
// target's draggables list.
else if (onTarget === null) {
onTarget = target;
target.draggable.push(draggableObj.id);
else if (this.onTarget === null) {
this.onTarget = target;
target.draggable.push(this.id);
}
if (target.numTextEl !== null) {
......@@ -567,43 +596,45 @@ define(['logme', 'update_input'], function (logme, updateInput) {
// Reposition the draggable so that it's center
// coincides with the center of the target.
snapToTarget(target);
this.snapToTarget(target);
break;
}
return targetFound;
}
function snapToTarget(target) {
var offset;
offset = 0;
if (state.config.targetOutline === true) {
if (this.state.config.targetOutline === true) {
offset = 1;
}
draggableObj.iconEl.css(
this.iconEl.css(
'left',
target.offset.left + 0.5 * target.w -
draggableObj.iconWidth * 0.5 + offset
- draggableObj.iconElLeftOffset
this.iconWidth * 0.5 + offset
- this.iconElLeftOffset
);
draggableObj.iconEl.css(
this.iconEl.css(
'top',
target.offset.top + 0.5 * target.h -
draggableObj.iconHeight * 0.5 + offset
this.iconHeight * 0.5 + offset
);
if (draggableObj.labelEl !== null) {
draggableObj.labelEl.css(
if (this.labelEl !== null) {
this.labelEl.css(
'left',
target.offset.left + 0.5 * target.w -
draggableObj.labelWidth * 0.5 + offset
this.labelWidth * 0.5 + offset
- 9 // Acoount for padding, border.
);
draggableObj.labelEl.css(
this.labelEl.css(
'top',
target.offset.top + 0.5 * target.h +
draggableObj.iconHeight * 0.5 + 5 + offset
this.iconHeight * 0.5 + 5 + offset
);
}
}
......@@ -621,22 +652,17 @@ define(['logme', 'update_input'], function (logme, updateInput) {
function correctZIndexes() {
var draggablesInMe, c1, c2, highestZIndex;
if (state.individualTargets === true) {
logme('In correctZIndexes.');
if (onTarget.draggable.length > 0) {
logme('onTarget.draggable.length > 0');
if (this.state.individualTargets === true) {
if (this.onTarget.draggable.length > 0) {
draggablesInMe = [];
for (c1 = 0; c1 < onTarget.draggable.length; c1 += 1) {
for (c2 = 0; c2 < state.draggables.length; c2 += 1) {
for (c1 = 0; c1 < this.onTarget.draggable.length; c1 += 1) {
for (c2 = 0; c2 < this.state.draggables.length; c2 += 1) {
if (
onTarget.draggable[c1] ===
state.draggables[c2].id
this.onTarget.draggable[c1] ===
this.state.draggables[c2].id
) {
draggablesInMe.push(state.draggables[c2]);
draggablesInMe.push(this.state.draggables[c2]);
}
}
}
......@@ -653,20 +679,11 @@ define(['logme', 'update_input'], function (logme, updateInput) {
}
if (highestZIndex === -10000) {
highestZIndex = onTarget.draggable.length;
} else if (highestZIndex < draggableObj.oldZIndex) {
highestZIndex = draggableObj.oldZIndex;
highestZIndex = this.onTarget.draggable.length;
} else if (highestZIndex < this.oldZIndex) {
highestZIndex = this.oldZIndex;
} else {
for (c1 = 0; c1 < draggablesInMe.length; c1 += 1) {
logme('draggablesInMe[' + c1 + '].id = ' + draggablesInMe[c1].id);
logme('draggablesInMe[' + c1 + '].zIndex = ' + draggablesInMe[c1].zIndex);
logme('draggablesInMe[' + c1 + '].oldZIndex = ' + draggablesInMe[c1].oldZIndex);
}
logme('----------------');
logme('highestZIndex = ' + highestZIndex);
for (c1 = 0; c1 < draggablesInMe.length; c1 += 1) {
draggablesInMe[c1].zIndex -= 1;
draggablesInMe[c1].oldZIndex -= 1;
......@@ -683,51 +700,50 @@ define(['logme', 'update_input'], function (logme, updateInput) {
}
}
} else {
logme('highestZIndex = onTarget.draggable.length');
highestZIndex = onTarget.draggable.length;
highestZIndex = this.onTarget.draggable.length;
}
draggableObj.zIndex = highestZIndex;
draggableObj.oldZIndex = highestZIndex;
this.zIndex = highestZIndex;
this.oldZIndex = highestZIndex;
draggableObj.iconEl.css(
this.iconEl.css(
'z-index',
draggableObj.zIndex
this.zIndex
);
if (draggableObj.labelEl !== null) {
draggableObj.labelEl.css(
if (this.labelEl !== null) {
this.labelEl.css(
'z-index',
draggableObj.zIndex
this.zIndex
);
}
} else {
for (c1 = 0; c1 < state.draggables.length; c1++) {
for (c1 = 0; c1 < this.state.draggables.length; c1++) {
if (
draggableObj.oldZIndex <
state.draggables[c1].zIndex
this.oldZIndex <
this.state.draggables[c1].zIndex
) {
state.draggables[c1].zIndex -= 1;
state.draggables[c1].oldZIndex = state.draggables[c1].zIndex;
state.draggables[c1].iconEl.css(
this.state.draggables[c1].zIndex -= 1;
this.state.draggables[c1].oldZIndex = this.state.draggables[c1].zIndex;
this.state.draggables[c1].iconEl.css(
'z-index',
state.draggables[c1].zIndex
this.state.draggables[c1].zIndex
);
if (state.draggables[c1].labelEl !== null) {
state.draggables[c1].labelEl.css(
if (this.state.draggables[c1].labelEl !== null) {
this.state.draggables[c1].labelEl.css(
'z-index',
state.draggables[c1].zIndex
this.state.draggables[c1].zIndex
);
}
}
}
draggableObj.zIndex = c1;
draggableObj.oldZIndex = c1;
draggableObj.iconEl.css('z-index', c1);
this.zIndex = c1;
this.oldZIndex = c1;
this.iconEl.css('z-index', c1);
if (draggableObj.labelEl !== null) {
draggableObj.labelEl.css('z-index', c1);
if (this.labelEl !== null) {
this.labelEl.css('z-index', c1);
}
}
}
......@@ -736,63 +752,60 @@ define(['logme', 'update_input'], function (logme, updateInput) {
// move it back to the slider, placing it in the same position
// that it was dragged out of.
function moveBackToSlider() {
draggableObj.containerEl.show();
this.containerEl.show();
draggableObj.zIndex = draggableObj.oldZIndex;
this.zIndex = this.oldZIndex;
draggableObj.iconEl.detach();
draggableObj.iconEl.css('border', 'none');
draggableObj.iconEl.css('background-color', 'transparent');
draggableObj.iconEl.css('padding-left', 0);
draggableObj.iconEl.css('padding-right', 0);
draggableObj.iconEl.css('z-index', draggableObj.zIndex);
draggableObj.iconEl.css(
this.iconEl.detach();
this.iconEl.css('border', 'none');
this.iconEl.css('background-color', 'transparent');
this.iconEl.css('padding-left', 0);
this.iconEl.css('padding-right', 0);
this.iconEl.css('z-index', this.zIndex);
this.iconEl.css(
'width',
draggableObj.iconWidthSmall
this.iconWidthSmall
);
draggableObj.iconEl.css(
this.iconEl.css(
'height',
draggableObj.iconHeightSmall
this.iconHeightSmall
);
draggableObj.iconEl.css(
this.iconEl.css(
'left',
50 - draggableObj.iconWidthSmall * 0.5
50 - this.iconWidthSmall * 0.5
);
if (draggableObj.labelEl !== null) {
draggableObj.iconEl.css('top', 5);
if (this.labelEl !== null) {
this.iconEl.css('top', 5);
} else {
draggableObj.iconEl.css(
this.iconEl.css(
'top',
50 - draggableObj.iconHeightSmall * 0.5
50 - this.iconHeightSmall * 0.5
);
}
draggableObj.iconEl.appendTo(draggableObj.containerEl);
this.iconEl.appendTo(this.containerEl);
if (draggableObj.labelEl !== null) {
draggableObj.labelEl.detach();
draggableObj.labelEl.css('border', 'none');
draggableObj.labelEl.css('background-color', 'transparent');
draggableObj.labelEl.css('padding-left', 0);
draggableObj.labelEl.css('padding-right', 0);
draggableObj.labelEl.css('z-index', draggableObj.zIndex);
draggableObj.labelEl.css(
if (this.labelEl !== null) {
this.labelEl.detach();
this.labelEl.css('border', 'none');
this.labelEl.css('background-color', 'transparent');
this.labelEl.css('padding-left', 0);
this.labelEl.css('padding-right', 0);
this.labelEl.css('z-index', this.zIndex);
this.labelEl.css(
'left',
50 - draggableObj.labelWidth * 0.5
50 - this.labelWidth * 0.5
);
draggableObj.labelEl.css(
this.labelEl.css(
'top',
5 + draggableObj.iconHeightSmall + 5
5 + this.iconHeightSmall + 5
);
draggableObj.labelEl.appendTo(
draggableObj.containerEl
this.labelEl.appendTo(
this.containerEl
);
}
inContainer = true;
}
}
}
this.inContainer = true;
}
});
......
......@@ -63,7 +63,9 @@ define(
Targets(state);
Scroller(state);
Draggables(state);
Draggables.init(state);
logme('After Draggables.init(state); state = ', state);
// Update the input element, checking first that it is not filled with
// an answer from the server.
......
......@@ -120,15 +120,6 @@ define(['logme'], function (logme) {
lowestZIndex = 10000;
for (c1 = 0; c1 < draggablesInMe.length; c1 += 1) {
logme(
'draggablesInMe[' + c1 + '].id = ' + draggablesInMe[c1].id,
'draggablesInMe[' + c1 + '].zIndex = ' + draggablesInMe[c1].zIndex,
'draggablesInMe[' + c1 + '].oldZIndex = ' + draggablesInMe[c1].oldZIndex
);
}
logme('------------------');
for (c1 = 0; c1 < draggablesInMe.length; c1 += 1) {
if (draggablesInMe[c1].zIndex < lowestZIndex) {
lowestZIndex = draggablesInMe[c1].zIndex;
}
......
......@@ -10,6 +10,8 @@ define(['logme'], function (logme) {
function updateInput(state, checkFirst) {
var inputEl, stateStr, targets, draggables, c1, c2, tempObj;
logme('updateInput; state = ', state);
if (checkFirst === true) {
if (checkIfHasAnswer() === true) {
return;
......@@ -126,7 +128,7 @@ define(['logme'], function (logme) {
return;
}
draggable.setInContainer(false);
draggable.inContainer = false;
draggable.containerEl.hide();
draggable.iconEl.detach();
......@@ -196,7 +198,7 @@ define(['logme'], function (logme) {
);
}
draggable.setOnTarget(target);
draggable.onTarget = target;
target.draggable.push(draggableId);
if (target.numTextEl !== null) {
......@@ -244,7 +246,7 @@ define(['logme'], function (logme) {
return;
}
draggable.setInContainer(false);
draggable.inContainer = false;
draggable.containerEl.hide();
draggable.iconEl.detach();
......
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