@@ -365,11 +365,23 @@ You can click on the <span style="color: ${incompleteColor}">orange</span> sciss
365365document . getElementById ( 'help' ) . addEventListener ( 'click' , help )
366366
367367ProofTree . prototype . image = function ( root ) {
368- let premiseImages = this . premises . map ( p => p . image ( root ) )
369-
370368 if ( this . completer ) {
371369 return this . completer . image ( root )
372370 }
371+
372+ let premiseImages = null
373+ if ( this . folded ) {
374+ premiseImages = this . premises . map ( p => {
375+ ellipses = new fabric . Text ( '...' , {
376+ fontFamily : 'Helvetica' ,
377+ fontSize : 30 ,
378+ stroke : 'black'
379+ } )
380+ return new fabric . Group ( [ ellipses ] , { } )
381+ } )
382+ } else {
383+ premiseImages = this . premises . map ( p => p . image ( root ) )
384+ }
373385 let isIncomplete = this instanceof LKIncomplete || this instanceof HoareIncomplete
374386
375387
@@ -446,6 +458,7 @@ ProofTree.prototype.image = function (root) {
446458 let ruleLabel = null
447459 let deleteLabel = null
448460 let detachLabel = null
461+ let foldLabel = null
449462 if ( isIncomplete ) {
450463 ruleLabel = new fabric . Text ( ' + ' , {
451464 fontFamily : 'Helvetica' ,
@@ -660,6 +673,21 @@ ProofTree.prototype.image = function (root) {
660673 refreshAll ( )
661674 }
662675 } )
676+
677+ if ( this . premises . length > 0 ) {
678+ let n = "⃠"
679+ foldLabel = new fabric . Text ( n , {
680+ fontFamily : 'Helvetica' ,
681+ fontSize : 11 ,
682+ stroke : this . folded ? 'lightgray' : 'black' ,
683+ hoverCursor : 'pointer' ,
684+ backgroundColor : this . folded ? 'black' : 'lightgray'
685+ } )
686+ foldLabel . on ( 'mousedown' , async ( e ) => {
687+ this . folded = ! this . folded
688+ refreshAll ( )
689+ } )
690+ }
663691 }
664692
665693 ruleLabel . setPositionByOrigin (
@@ -671,7 +699,13 @@ ProofTree.prototype.image = function (root) {
671699 ( new fabric . Point ( 15 , 5 ) ) . add ( ruleLabel . getPointByOrigin ( 'right' , 'top' ) , 'left' , 'top' ) )
672700 detachLabel . setPositionByOrigin (
673701 ( new fabric . Point ( 30 , 5 ) ) . add ( ruleLabel . getPointByOrigin ( 'right' , 'top' ) , 'left' , 'top' ) )
674- groupImages = [ premiseGroup , line , ruleLabel , deleteLabel , detachLabel , text ]
702+ if ( foldLabel ) {
703+ foldLabel . setPositionByOrigin (
704+ ( new fabric . Point ( 45 , 5 ) ) . add ( ruleLabel . getPointByOrigin ( 'right' , 'top' ) , 'left' , 'top' ) )
705+ groupImages = [ premiseGroup , line , ruleLabel , deleteLabel , detachLabel , foldLabel , text ]
706+ } else {
707+ groupImages = [ premiseGroup , line , ruleLabel , deleteLabel , detachLabel , text ]
708+ }
675709 } else {
676710 groupImages = [ premiseGroup , line , ruleLabel , text ]
677711 }
0 commit comments