mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	excludeFromTreeMap generalized to excludeFromNoteMap
This commit is contained in:
		| @@ -8,7 +8,7 @@ module.exports = () => { | |||||||
| 
 | 
 | ||||||
|         for (const note of Object.values(becca.notes)) { |         for (const note of Object.values(becca.notes)) { | ||||||
|             if (note.hasLabel('calendarRoot')) { |             if (note.hasLabel('calendarRoot')) { | ||||||
|                 note.addLabel('excludeFromTreeMap', "", true); |                 note.addLabel('excludeFromNoteMap', "", true); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
| @@ -119,11 +119,15 @@ export default class NoteMapWidget extends NoteContextAwareWidget { | |||||||
|  |  | ||||||
|         let mapRootNoteId = this.getMapRootNoteId(); |         let mapRootNoteId = this.getMapRootNoteId(); | ||||||
|         const data = await this.loadNotesAndRelations(mapRootNoteId); |         const data = await this.loadNotesAndRelations(mapRootNoteId); | ||||||
|  |  | ||||||
|         const nodeLinkRatio = data.nodes.length / data.links.length; |         const nodeLinkRatio = data.nodes.length / data.links.length; | ||||||
|  |         const magnifiedRatio = Math.pow(nodeLinkRatio, 1.5); | ||||||
|  |         const charge = -20 / magnifiedRatio; | ||||||
|  |         const boundedCharge = Math.min(-3, charge); | ||||||
|  |  | ||||||
|         this.graph.d3Force('link').distance(40); |         this.graph.d3Force('link').distance(40); | ||||||
|         this.graph.d3Force('center').strength(0.2); |         this.graph.d3Force('center').strength(0.2); | ||||||
|         this.graph.d3Force('charge').strength(-20 / Math.pow(nodeLinkRatio, 1.5)); |         this.graph.d3Force('charge').strength(boundedCharge); | ||||||
|         this.graph.d3Force('charge').distanceMax(1000); |         this.graph.d3Force('charge').distanceMax(1000); | ||||||
|  |  | ||||||
|         this.renderData(data); |         this.renderData(data); | ||||||
|   | |||||||
| @@ -26,10 +26,14 @@ function buildDescendantCountMap() { | |||||||
|  |  | ||||||
| function getLinkMap(req) { | function getLinkMap(req) { | ||||||
|     const mapRootNote = becca.getNote(req.params.noteId); |     const mapRootNote = becca.getNote(req.params.noteId); | ||||||
|  |     // if the map root itself has ignore (journal typically) then there wouldn't be anything to display so | ||||||
|  |     // we'll just ignore it | ||||||
|  |     const ignoreExcludeFromNoteMap = mapRootNote.hasLabel('excludeFromNoteMap'); | ||||||
|  |  | ||||||
|     const noteIds = new Set(); |     const noteIds = new Set(); | ||||||
|  |  | ||||||
|     const notes = mapRootNote.getSubtreeNotes(false) |     const notes = mapRootNote.getSubtreeNotes(false) | ||||||
|  |         .filter(note => ignoreExcludeFromNoteMap || !note.hasLabel('excludeFromNoteMap')) | ||||||
|         .map(note => [ |         .map(note => [ | ||||||
|             note.noteId, |             note.noteId, | ||||||
|             note.isContentAvailable() ? note.title : '[protected]', |             note.isContentAvailable() ? note.title : '[protected]', | ||||||
| @@ -72,11 +76,11 @@ function getTreeMap(req) { | |||||||
|     const mapRootNote = becca.getNote(req.params.noteId); |     const mapRootNote = becca.getNote(req.params.noteId); | ||||||
|     // if the map root itself has ignore (journal typically) then there wouldn't be anything to display so |     // if the map root itself has ignore (journal typically) then there wouldn't be anything to display so | ||||||
|     // we'll just ignore it |     // we'll just ignore it | ||||||
|     const ignoreExcludeFromTreeMap = mapRootNote.hasLabel('excludeFromTreeMap'); |     const ignoreExcludeFromNoteMap = mapRootNote.hasLabel('excludeFromNoteMap'); | ||||||
|     const noteIds = new Set(); |     const noteIds = new Set(); | ||||||
|  |  | ||||||
|     const notes = mapRootNote.getSubtreeNotes(false) |     const notes = mapRootNote.getSubtreeNotes(false) | ||||||
|         .filter(note => ignoreExcludeFromTreeMap || !note.hasLabel('excludeFromTreeMap')) |         .filter(note => ignoreExcludeFromNoteMap || !note.hasLabel('excludeFromNoteMap')) | ||||||
|         .filter(note => { |         .filter(note => { | ||||||
|             if (note.type !== 'image' || note.getChildNotes().length > 0) { |             if (note.type !== 'image' || note.getChildNotes().length > 0) { | ||||||
|                 return true; |                 return true; | ||||||
|   | |||||||
| @@ -47,7 +47,7 @@ const BUILTIN_ATTRIBUTES = [ | |||||||
|     { type: 'label', name: 'pageSize' }, |     { type: 'label', name: 'pageSize' }, | ||||||
|     { type: 'label', name: 'viewType' }, |     { type: 'label', name: 'viewType' }, | ||||||
|     { type: 'label', name: 'mapRootNoteId' }, |     { type: 'label', name: 'mapRootNoteId' }, | ||||||
|     { type: 'label', name: 'excludeFromTreeMap' }, |     { type: 'label', name: 'excludeFromNoteMap' }, | ||||||
|  |  | ||||||
|     // relation names |     // relation names | ||||||
|     { type: 'relation', name: 'runOnNoteCreation', isDangerous: true }, |     { type: 'relation', name: 'runOnNoteCreation', isDangerous: true }, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user