+var TextHandler = function(canvas) {this.canvas = canvas; this.buffer = null};
+$.extend(TextHandler.prototype, {
+ handle: function(node, text) {
+ //console.log('canvas text handler: ' + text);
+ this.setText(text, node);
+ return;
+ if(!this.node) {
+ this.node = node;
+ }
+ if(this.node.sameNode(node)) {
+ this._ping(text);
+ } else {
+ this.flush();
+ this.node = node;
+ this._ping(text);
+ }
+ },
+ _ping: _.throttle(function(text) {
+ this.buffer = text;
+ this.flush();
+ }, 1000),
+ flush: function() {
+ if(this.buffer != null) {
+ this.setText(this.buffer, this.node);
+ this.buffer = null;
+ }
+ },
+ setText: function(text, node) {
+ //this.canvas.wlxmlDocument.transform('setText', {node:node, text: text});
+ node.setText(text);
+
+ }
+
+});
+
+