Cards: Fix card Z ordering

This commit is contained in:
2015-07-02 19:17:29 +02:00
parent f872c49c73
commit dd1869f124
2 changed files with 39 additions and 27 deletions

View File

@@ -125,6 +125,8 @@ namespace VAR.Focus.Web.Code.BusinessLogic
card.Y = y;
card.ModifiedBy = currentUserName;
card.ModifiedDate = currentDate;
_cards.Remove(card);
_cards.Add(card);
// Create event
_lastIDCardEvent++;
@@ -156,6 +158,8 @@ namespace VAR.Focus.Web.Code.BusinessLogic
card.Body = body;
card.ModifiedBy = currentUserName;
card.ModifiedDate = currentDate;
_cards.Remove(card);
_cards.Add(card);
// Create event
_lastIDCardEvent++;

View File

@@ -49,6 +49,10 @@ var Toolbox = function (cfg, container) {
this.offsetY = 0;
};
Toolbox.prototype = {
ReInsertOnContainer: function () {
this.container.removeChild(this.divToolbox);
this.container.appendChild(this.divToolbox);
},
GetRelativePosToContainer: function (pos) {
var tempElem = this.container;
var relPos = { x: pos.x, y: pos.y };
@@ -211,6 +215,7 @@ Card.prototype = {
InsertInContainer: function (container) {
this.container = container;
this.container.appendChild(this.divCard);
this.cfg.Toolbox.ReInsertOnContainer();
},
RemoveFromContainer: function(){
this.container.removeChild(this.divCard);
@@ -236,6 +241,7 @@ Card.prototype = {
this.animData = null;
},
Move: function (x, y) {
this.OnMoveStart();
this.X = x;
this.Y = y;
this.newX = x;
@@ -262,6 +268,8 @@ Card.prototype = {
this.newBody = body;
this.divTitle.innerHTML = this.FilterText(this.Title);
this.divBody.innerHTML = this.FilterText(this.Body);
this.RemoveFromContainer();
this.InsertInContainer(this.cfg.divBoard);
},
Reset: function () {
this.newX = this.X;
@@ -294,36 +302,36 @@ Card.prototype = {
window.clearTimeout(this.animData.animationID);
this.animData = null;
}
this.RemoveFromContainer();
this.InsertInContainer(this.cfg.divBoard);
},
OnMove: function () {
if (this.X != this.newX || this.Y != this.newY) {
var card = this;
if (this.cfg.Connected == false) {
card.Reset();
return;
}
var data = {
"IDBoard": this.cfg.IDBoard,
"Command": "Move",
"IDCard": this.IDCard,
"X": this.newX,
"Y": this.newY,
"TimeStamp": new Date().getTime()
};
SendData(this.cfg.ServiceUrl, data,
function (responseText) {
try {
var recvData = JSON.parse(responseText);
if (recvData && recvData instanceof Object && recvData.IsOK == true) {
card.SetNew();
} else {
card.Reset();
}
} catch (e) { }
}, function () {
card.Reset();
});
var card = this;
if (this.cfg.Connected == false) {
card.Reset();
return;
}
var data = {
"IDBoard": this.cfg.IDBoard,
"Command": "Move",
"IDCard": this.IDCard,
"X": this.newX,
"Y": this.newY,
"TimeStamp": new Date().getTime()
};
SendData(this.cfg.ServiceUrl, data,
function (responseText) {
try {
var recvData = JSON.parse(responseText);
if (recvData && recvData instanceof Object && recvData.IsOK == true) {
card.SetNew();
} else {
card.Reset();
}
} catch (e) { }
}, function () {
card.Reset();
});
},
OnEdit: function () {
if (this.Title != this.newTitle || this.Body != this.newBody) {