Sending state now works. Still some bugs in handling the state updates

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@82 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Vidar Hokstad
2009-06-09 22:39:58 +00:00
parent 6fda1f7d99
commit cd86b6520c

View File

@@ -138,8 +138,10 @@
function stateUpdated() { function stateUpdated() {
var state = wave.getState(); var state = wave.getState();
var keys = state.getKeys(); var keys = state.getKeys();
document.canvas.each(function(e) { canvas.each(function(e) {
if (e) { //alert(e);
var v = state.get(e.nodeId);
if (v) {
var ob; var ob;
var v = state.get(e.nodeId); var v = state.get(e.nodeId);
eval("ob="+v); // FIXME: Yes, I'm using eval... Dirty, dirty.. eval("ob="+v); // FIXME: Yes, I'm using eval... Dirty, dirty..
@@ -157,14 +159,14 @@
// New nodes // New nodes
for (var k in keys) { for (var k in keys) {
var ob; var ob;
var v = state.get(e.nodeId); var v = state.get(k);
eval("ob="+v); // FIXME: Yes, I'm using eval... Dirty, dirty.. eval("ob="+v); // FIXME: Yes, I'm using eval... Dirty, dirty..
if (ob) canvas.updateElementFromJson(data) if (ob) canvas.updateElementFromJson(data)
} }
} }
function sendDelta(canvas, elem) { function sendDelta(canvas, elem) {
if (wave) return; if (!wave) return;
var delta = {}; var delta = {};
var attrs = {}; var attrs = {};
var a = elem.attributes; var a = elem.attributes;