open_empty does not clear canvas? - how to clear mindmap for a new start?
opto opened this issue · comments
steps to reproduce:
call open_empty()
create a few nodes
call open_empty() again
I would expect to see again the default node = root. But I also see the nodes that were created in step 1. By debugging, I see that the a lot is reset, the new node list is ok, so maybe the canvas is not cleared?
Thanks for your help and the good library.
open_empty()
is not a documented api of jsMind.
if you want open a empty mindmap multiple times, please follow the code below:
// create a jsMind instance
var jm = new jsMind(options);
// open an empty map
jm.show()
// open an empty map again
jm.show()
please note that, we can show
multiple times, but new jsMind
once.
doc about that: https://github.com/hizzgdev/jsmind/blob/master/docs/en/1.usage.md
many thanks.
Unfortunately, it gives this (first your log, then error message):
view.reset jsmind.js:2406:20
Uncaught (in promise) TypeError: this.graph_canvas is undefined
in jsmind.js:2411:13
What to do?
as options, I took those from the example, which may be wrong:
var options = {
container: 'jsmind_container',
theme: 'opto',
editable: true,
view: {
draggable: true,
}
};
if I follow usage 1, then jm.show() throws an error because this.graph_canvas does not exist.
That also happens if I include canvas explicitly in the options.
If I change view.reset() to
if (this.graph_canvas) this.graph_canvas.clear();
all is fine
Thanks for reporting the issue, I will check it later.
Hi @opto , would you please share more context about the issue? I can not reproduce the bug on my laptop. Entire html would be better.
I will make a pull request for a function to Set text color. I think that does not exist yet. In that context my question will be more clear..
There is a method to set text color: jm.set_node_color(node_id, bg_color, fg_color) , so you don't have to. @opto
fg_color
is the text color
I know, I have added text/font color
Just sah the Part concerning FG color, I will try that