Trying to replace the prefix with a mechanism for using a callback for the id; wave.Participant() shouldn't work - Participant() is the constructor for the Participant objects returned from getViewer() etc.

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@127 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Vidar Hokstad
2009-06-12 18:34:28 +00:00
parent 4965ba1760
commit cf30bd0bb4
2 changed files with 4 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ function SvgCanvas(c)
// private functions
var getId = function() {
if (events["getid"]) return call("getid",obj_num);
return idprefix+obj_num;
}

View File

@@ -257,18 +257,18 @@ SVG-edit Google Wave Gadget @ <a href="http://svg-edit.googlecode.com/" target="
wave.getState().submitDelta(delta);
}
function setupId() {
svgCanvas.setIdPrefix("svg_"+wave.Participant().getId()+"_");
function getId(objnum) {
return "svg_"+wave.getViewer().getId()+"_"+objnum;
}
function main() {
svgCanvas = svg_edit_setup();
if (wave && wave.isInWaveContainer()) {
wave.setStateCallback(stateUpdated);
wave.setParticipantCallback(setupId);
}
svgCanvas.bind("changed", sendDelta);
svgCanvas.bind("cleared", stateUpdated);
svgCanvas.bind("getid", getId);
}
gadgets.util.registerOnLoadHandler(main);