boxes going crazy after page move

This commit is contained in:
Sanj 2011-10-21 00:58:22 +01:00
parent 58edc4d4c9
commit 04a0e2ea87

View File

@ -279,7 +279,7 @@ Canvas.prototype.init = function() {
} }
var html = tmpl("tmpl_canvas", json); var html = tmpl("tmpl_canvas", json);
this.parent.append(html); this.parent.append(html);
this.jq = $('#' + 'canvas' + that.index.toString()); this.jq = $('#' + 'canvas' + that.index.toString()).data("canvas", that);
this.jq.css({'height': heightPx, 'width': widthPx}); this.jq.css({'height': heightPx, 'width': widthPx});
this.jq.find('.ruler_vert').draggable({ this.jq.find('.ruler_vert').draggable({
snap: '.box', snap: '.box',
@ -294,7 +294,8 @@ Canvas.prototype.init = function() {
this.jq.droppable({accept:'.resource, .newTextBox', this.jq.droppable({accept:'.resource, .newTextBox',
drop: function(ev, ui) { drop: function(ev, ui) {
var box = $(this).getBox().jq; var box = $(this).getBox().jq;
c = edgeArticle[$(this).attr('data-index')]; // c = edgeArticle[$(this).attr('data-index')];
c = $(this).data("canvas");
if ($(ui.draggable).attr('class') == 'resource ui-draggable') { if ($(ui.draggable).attr('class') == 'resource ui-draggable') {
r = edgeBin.allResources[$(ui.draggable).attr("data-index")]; r = edgeBin.allResources[$(ui.draggable).attr("data-index")];
if (r.mime == 'image') { if (r.mime == 'image') {