kisst / mindmap

d3j + yaml + html = magic
Apache License 2.0
3 stars 2 forks source link

Create a navigation bar #16

Open kisst opened 4 years ago

kisst commented 4 years ago

The edit this parameter in the URL query parameters works for some, but not an option for everyone, a gui option to fabricate this parameters is needed for at least the following.

For the file item, a simple file picker should work, for the root item picker, that's two fold. One is to limit the scope aka zoom in, that can be done with a left-click option "hide parents" or "set as root", and the other half is the zoom out, which could be done either with a history navigation bar, or with a side menu.

JSomerstone commented 4 years ago

Working on this in https://github.com/JSomerstone/mindmap/tree/feature/navigation

JSomerstone commented 4 years ago
Screenshot 2020-04-22 at 16 57 14
kisst commented 4 years ago

@JSomerstone just merged it, but discovered a small bug, the setting up the root url parameter is ignoring any existing url parameters like src_data or initial

Given an data2.yaml as source data, set as source by ?src_data=data2.yaml, when zooming in into the sub-key within data2, the url should be ?src_data=data2.yaml&root=sub-key not just ?root=sub-key, but to complicate matters further, the initial parameter would be either need to be modified, or removed, as the root does override the sources data, hence root + initial have to be changed in sync.

Now one of the alternative is move the config option of the data src location, either into the html directly or somewhere else, because let's be frank, that is a rare use-case, or we need to smarten up more the url amending.

@evenicoulddoit @anttisalo what do you think ? :thinking:

JSomerstone commented 4 years ago

Moving from links to dynamically editing the query parameters would be the solution IMO.

setting document.location.search in combination with URLSearchParam.set() should do the trick (https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/set)

JSomerstone commented 4 years ago

Made new PR: https://github.com/kisst/mindmap/pull/23