mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	chore(client/ts): port note_map
This commit is contained in:
		
							parent
							
								
									befdade7ba
								
							
						
					
					
						commit
						32fc5def77
					
				@ -163,7 +163,7 @@ export default class NoteMapWidget extends NoteContextAwareWidget {
 | 
				
			|||||||
    private themeStyle!: string;
 | 
					    private themeStyle!: string;
 | 
				
			||||||
    private $container!: JQuery<HTMLElement>;
 | 
					    private $container!: JQuery<HTMLElement>;
 | 
				
			||||||
    private $styleResolver!: JQuery<HTMLElement>;
 | 
					    private $styleResolver!: JQuery<HTMLElement>;
 | 
				
			||||||
    private graph!: ForceGraph;
 | 
					    graph!: ForceGraph;
 | 
				
			||||||
    private noteIdToSizeMap!: Record<string, number>;
 | 
					    private noteIdToSizeMap!: Record<string, number>;
 | 
				
			||||||
    private zoomLevel!: number;
 | 
					    private zoomLevel!: number;
 | 
				
			||||||
    private nodes!: Node[];
 | 
					    private nodes!: Node[];
 | 
				
			||||||
 | 
				
			|||||||
@ -33,6 +33,13 @@ const TPL = `
 | 
				
			|||||||
</div>`;
 | 
					</div>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default class NoteMapRibbonWidget extends NoteContextAwareWidget {
 | 
					export default class NoteMapRibbonWidget extends NoteContextAwareWidget {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private openState!: "small" | "full";
 | 
				
			||||||
 | 
					    private noteMapWidget: NoteMapWidget;
 | 
				
			||||||
 | 
					    private $container!: JQuery<HTMLElement>;
 | 
				
			||||||
 | 
					    private $openFullButton!: JQuery<HTMLElement>;
 | 
				
			||||||
 | 
					    private $collapseButton!: JQuery<HTMLElement>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    constructor() {
 | 
					    constructor() {
 | 
				
			||||||
        super();
 | 
					        super();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -106,7 +113,7 @@ export default class NoteMapRibbonWidget extends NoteContextAwareWidget {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    setSmallSize() {
 | 
					    setSmallSize() {
 | 
				
			||||||
        const SMALL_SIZE_HEIGHT = 300;
 | 
					        const SMALL_SIZE_HEIGHT = 300;
 | 
				
			||||||
        const width = this.$widget.width();
 | 
					        const width = this.$widget.width() ?? 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.$widget.find(".note-map-container").height(SMALL_SIZE_HEIGHT).width(width);
 | 
					        this.$widget.find(".note-map-container").height(SMALL_SIZE_HEIGHT).width(width);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -114,9 +121,11 @@ export default class NoteMapRibbonWidget extends NoteContextAwareWidget {
 | 
				
			|||||||
    setFullHeight() {
 | 
					    setFullHeight() {
 | 
				
			||||||
        const { top } = this.$widget[0].getBoundingClientRect();
 | 
					        const { top } = this.$widget[0].getBoundingClientRect();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const height = $(window).height() - top;
 | 
					        const height = ($(window).height() ?? 0) - top;
 | 
				
			||||||
        const width = this.$widget.width();
 | 
					        const width = (this.$widget.width() ?? 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.$widget.find(".note-map-container").height(height).width(width);
 | 
					        this.$widget.find(".note-map-container")
 | 
				
			||||||
 | 
					            .height(height)
 | 
				
			||||||
 | 
					            .width(width);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user