@@ -193,7 +193,7 @@ const refreshList = () => {
193193}
194194
195195const addProof = ( pf ) => {
196- proofs . push ( { proof : pf , x : null , y : null , incompletes : [ ] } )
196+ proofs . push ( { proof : pf , x1 : null , x2 : null , y : null , incompletes : [ ] } )
197197 pf . draw ( )
198198 refreshList ( )
199199}
@@ -721,7 +721,8 @@ ProofTree.prototype.image = function (root) {
721721 group . on ( 'moved' , e => {
722722 proofs . forEach ( ( entry , i ) => {
723723 if ( root == entry . proof ) {
724- proofs [ i ] . x = e . target . aCoords . bl . x
724+ proofs [ i ] . x1 = e . target . aCoords . bl . x
725+ proofs [ i ] . x2 = e . target . aCoords . br . x
725726 proofs [ i ] . y = e . target . aCoords . bl . y
726727 }
727728 } )
@@ -738,16 +739,18 @@ ProofTree.prototype.image = function (root) {
738739 return group
739740}
740741
742+
741743ProofTree . prototype . draw = function ( ) {
742744 proofs . forEach ( ( entry , i ) => { if ( this == entry . proof ) proofs [ i ] . incompletes = [ ] } )
743745 let im = this . image ( this )
744746 proofs . forEach ( ( entry , i ) => {
745747 if ( this == entry . proof ) {
746- if ( entry . x == null || entry . y == null ) {
747- proofs [ i ] . x = ( window . innerWidth - im . width ) / 2
748+ if ( entry . x1 == null || entry . x2 == null || entry . y == null ) {
749+ proofs [ i ] . x1 = ( window . innerWidth - im . width ) / 2
750+ proofs [ i ] . x2 = ( window . innerWidth + im . width ) / 2
748751 proofs [ i ] . y = ( window . innerHeight + im . height ) / 2
749752 }
750- im . setPositionByOrigin ( new fabric . Point ( proofs [ i ] . x , proofs [ i ] . y ) , 'left ' , 'bottom' )
753+ im . setPositionByOrigin ( new fabric . Point ( ( proofs [ i ] . x1 + proofs [ i ] . x2 ) / 2 , proofs [ i ] . y ) , 'center ' , 'bottom' )
751754 proofs [ i ] . image = im
752755 }
753756 } )
0 commit comments