@@ -451,51 +451,30 @@ class Link {
451451 }
452452
453453 listenForEdit ( e ) {
454- console . log ( 'listening' , e . detail . text , e . detail . text . text ( ) ) ;
455454 this . isEditing = true ;
456455
457456 let bbox = e . detail . text . bbox ( ) ;
458- this . svg . addClass ( 'editing' ) ;
457+ e . detail . text . addClass ( 'editing-text' ) ;
458+ this . editingText = e . detail . text ;
459459 this . editingRect = this . svg . rect ( bbox . width + 8 , bbox . height + 4 )
460460 . x ( bbox . x - 4 )
461461 . y ( bbox . y - 2 )
462462 . rx ( 2 )
463463 . ry ( 2 )
464+ . addClass ( 'editing-rect' )
464465 . back ( ) ;
465-
466- // listenForEdit() {
467- // this.isEditing = true;
468- // let bbox = this.svgText.bbox();
469- //
470- // this.svg.addClass('editing');
471- // this.editingRect = this.svg.rect(bbox.width + 8, bbox.height + 4)
472- // .x(bbox.x - 4)
473- // .y(bbox.y - 2)
474- // .rx(2)
475- // .ry(2)
476- // .back();
477- // }
478- // stopEditing() {
479- // this.isEditing = false;
480- // this.svg.removeClass('editing');
481- // this.editingRect.remove();
482- // this.editingRect = null;
483- // this.val = this.val.trim();
484- // if (!this.val) {
485- // this.remove();
486- // }
487- // else {
488- // this.entity.calculateBox();
489- // }
490- // }
491-
466+ }
467+ text ( str ) {
468+ if ( this . editingText ) {
469+ this . editingText . text ( str ) ;
470+ }
492471 }
493472 stopEditing ( ) {
494- console . log ( 'done' ) ;
495473 this . isEditing = false ;
496- this . svg . removeClass ( 'editing' ) ;
474+ this . editingText . removeClass ( 'editing-text ' ) ;
497475 this . editingRect . remove ( ) ;
498- this . editingRect = null ;
476+ this . editingRect = this . editingText = null ;
477+ this . draw ( ) ;
499478 }
500479
501480 getEndpoints ( ) {
0 commit comments