philogb/jit — Issue #85: autoWidth and autoHeight are not working
Author: alexanderte
Created: 2011-10-10 06:46:00+00:00
State: open

I’m doing an attempt at creating a mind mapping application, and I want to visualize the mind map by using jit.

I’ve got the latest commit[1], and I want to create a tree of nodes containing HTML. The HTML might be of any length and height. It could contain a label like «Things to do», a label containing paragraph, or even label containing a table.

I want the labels to have a size set automatically based on their content, but I cannot get this to work by setting `autoWitdth` and `autoHeight` to `true`. These parameters don’t do anything.

I've got the source code on GitHub[2], and this is the part of it that I think is relevant:

var st;
var json = {
id: "n1",
name: "root",
data: {},
children: [
{
id: "n2",
name: "foo1
foo2
foo3",
data: {},
children: [
// ...
]
},
{
id: "n3",
name: "bar",
data: {},
children: []
},
// ...
]
};

function init(){
st = new $jit.ST({
injectInto: 'view',

Node: {
autoHeight: true,
autoWidth: true,
},

onCreateLabel: function(label, node){
label.id = node.id;
label.innerHTML = node.name;
label.onclick = function() {
st.select(node.id);
};
},
});

st.loadJSON(json);
st.compute();
st.select(st.root);
}

[1]: 865c9af72ab7114c52f0c3e6bbed32787fd90090
[2]: https://github.com/alexanderte/MindMap/tree/3ef4f9f0b061d1d96754980ccc2ed548cd5c6bee