mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
Minor fixes for supporting shrink.
This commit is contained in:
parent
ef2902d724
commit
aee1dfbff9
@ -444,16 +444,15 @@ mindplot.Designer = new Class({
|
||||
|
||||
_nodeModelToNodeGraph : function(nodeModel, isVisible) {
|
||||
$assert(nodeModel, "Node model can not be null");
|
||||
var children = nodeModel.getChildren().slice();
|
||||
|
||||
var nodeGraph = this._buildNodeGraph(nodeModel);
|
||||
|
||||
if (isVisible)
|
||||
if (isVisible) {
|
||||
nodeGraph.setVisibility(isVisible);
|
||||
}
|
||||
|
||||
var children = nodeModel.getChildren();
|
||||
|
||||
var workspace = this._workspace;
|
||||
workspace.appendChild(nodeGraph);
|
||||
|
||||
this._workspace.appendChild(nodeGraph);
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
if ($defined(child))
|
||||
|
12
mindplot/src/main/javascript/layout/text.xml
Normal file
12
mindplot/src/main/javascript/layout/text.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<map name="mapId" version="pela">
|
||||
<topic central="true" id="0">
|
||||
<topic position="156,-49" order="0" id="1"/>
|
||||
<topic position="-156,-49" order="1" id="2"/>
|
||||
<topic position="156,-16" order="2" id="3"/>
|
||||
<topic position="-156,-16" order="3" id="4"/>
|
||||
<topic position="156,16" order="4" id="5"/>
|
||||
<topic position="-156,16" order="5" id="6"/>
|
||||
<topic position="156,49" order="6" id="7"/>
|
||||
<topic position="-156,49" order="7" id="8"/>
|
||||
</topic>
|
||||
</map>
|
@ -77,6 +77,7 @@ mindplot.nlayout.EventBusDispatcher = new Class({
|
||||
// Centra topic must not be added twice ...
|
||||
if (node.getId() != 0) {
|
||||
this._layoutManager.addNode(node.getId(), {width:10,height:10}, node.getPosition());
|
||||
this._layoutManager.updateShrinkState(node.getId(), node.areChildrenShrunken());
|
||||
}
|
||||
},
|
||||
|
||||
@ -85,12 +86,12 @@ mindplot.nlayout.EventBusDispatcher = new Class({
|
||||
},
|
||||
|
||||
_doLayout: function() {
|
||||
(function() {
|
||||
// (function() {
|
||||
this._layoutManager.layout(true);
|
||||
console.log("---------");
|
||||
this._layoutManager.dump();
|
||||
console.log("---------");
|
||||
}).delay(0, this);
|
||||
// }).delay(0, this);
|
||||
}
|
||||
|
||||
});
|
@ -145,16 +145,11 @@ mindplot.nlayout.LayoutManager = new Class({
|
||||
}
|
||||
|
||||
// Update nodes ...
|
||||
if (node.hasOrderChanged()) {
|
||||
event.setOrder(node.getOrder());
|
||||
node.resetOrderState();
|
||||
event.setOrder(node.getOrder());
|
||||
event.setPosition(node.getPosition());
|
||||
|
||||
}
|
||||
|
||||
if (node.hasPositionChanged()) {
|
||||
event.setPosition(node.getPosition());
|
||||
node.resetPositionState();
|
||||
}
|
||||
node.resetPositionState();
|
||||
node.resetOrderState();
|
||||
this._events.push(event);
|
||||
}
|
||||
this._collectChanges(this._treeSet.getChildren(node));
|
||||
|
@ -51,14 +51,14 @@ mindplot.nlayout.Node = new Class({
|
||||
resetPositionState : function() {
|
||||
var prop = this._properties['position'];
|
||||
if (prop) {
|
||||
prop.hasChanded = false;
|
||||
prop.hasChanged = false;
|
||||
}
|
||||
},
|
||||
|
||||
resetOrderState : function() {
|
||||
var prop = this._properties['order'];
|
||||
if (prop) {
|
||||
prop.hasChanded = false;
|
||||
prop.hasChanged = false;
|
||||
}
|
||||
},
|
||||
|
||||
@ -71,8 +71,8 @@ mindplot.nlayout.Node = new Class({
|
||||
},
|
||||
|
||||
hasPositionChanged: function() {
|
||||
return this._isPropertyChanged('position');
|
||||
|
||||
return this._isPropertyChanged('position');
|
||||
},
|
||||
|
||||
getPosition: function() {
|
||||
@ -100,17 +100,19 @@ mindplot.nlayout.Node = new Class({
|
||||
var prop = this._properties[key];
|
||||
if (!prop) {
|
||||
prop = {
|
||||
hasChanded:false,
|
||||
hasChanged:false,
|
||||
value: null,
|
||||
oldValue : null
|
||||
};
|
||||
}
|
||||
|
||||
prop.oldValue = prop.value;
|
||||
prop.value = value;
|
||||
prop.hasChanded = true;
|
||||
|
||||
this._properties[key] = prop;
|
||||
// Only update if the property has changed ...
|
||||
if (JSON.encode(prop.oldValue) != JSON.encode(value)) {
|
||||
prop.oldValue = prop.value;
|
||||
prop.value = value;
|
||||
prop.hasChanged = true;
|
||||
this._properties[key] = prop;
|
||||
}
|
||||
},
|
||||
|
||||
_getProperty: function(key) {
|
||||
@ -120,14 +122,7 @@ mindplot.nlayout.Node = new Class({
|
||||
|
||||
_isPropertyChanged: function(key) {
|
||||
var prop = this._properties[key];
|
||||
return prop ? prop.hasChanded : false;
|
||||
},
|
||||
|
||||
_setPropertyUpdated : function(key) {
|
||||
var prop = this._properties[key];
|
||||
if (prop) {
|
||||
this._properties[key] = true;
|
||||
}
|
||||
return prop ? prop.hasChanged : false;
|
||||
},
|
||||
|
||||
getSorter: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user