Deleting shapes should work but i cant really test it cause google wave is down righ tnow

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@525 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Kevin Kwok 2009-09-02 17:38:51 +00:00
parent 74cb13b6d7
commit 7704520e34
1 changed files with 23 additions and 3 deletions

View File

@ -62,7 +62,10 @@ function main() {
if (wave && wave.isInWaveContainer()) {
wave.setStateCallback(stateUpdated);
}
svgCanvas.bind("changed", function(canvas, elem){
var oldchanged = svgCanvas.bind("changed", function(canvas, elem){
if(oldchanged)oldchanged.apply(this, [canvas,elem]);
var delta = {}
$.each(elem, function(){
@ -76,13 +79,30 @@ function main() {
ob.time = shapetime[this.id] = (new Date).getTime()
delta[this.id] = JSON.stringify(ob);
}else{
alert(JSON.stringify(elem))
}
})
wave.getState().submitDelta(delta)
//sendDelta(canvas, elem)
});
var oldselected = svgCanvas.bind("selected", function(canvas, elem){
if(oldselected)oldselected.apply(this, [canvas,elem]);
var delta = {}
var deletions = 0;
$.each(elem, function(){
if(this != window && !this.parentNode){
delta[this.id] = null;
deletions ++
}
});
if(deletions > 0){
wave.getState().submitDelta(delta)
}
});
svgCanvas.bind("cleared", function(){
//alert("cleared")
var state = {}, keys = wave.getState().getKeys()