Revert "adding multiple line support editor and in nodes"

This reverts commit 5aa6775a85.
This commit is contained in:
Pablo Luna
2011-04-20 09:30:45 +01:00
parent fff2db0ab8
commit b678344991
19 changed files with 32 additions and 398 deletions

View File

@@ -24,9 +24,7 @@ mindplot.ActionIcon = function(topic, url) {
objects.extend(mindplot.ActionIcon, mindplot.Icon);
mindplot.ActionIcon.prototype.initialize = function() {
var pos = this.getImage.getPosition();
var size = this.getSize();
this._position = new core.Point(pos.x - size.width/2, pos.y - size.height/2);
};
mindplot.ActionIcon.prototype.getNode = function(){
@@ -35,14 +33,9 @@ mindplot.ActionIcon.prototype.getNode = function(){
mindplot.ActionIcon.prototype.setPosition = function(x,y){
var size = this.getSize();
this._position = new core.Point(x,y);
this.getImage().setPosition(x-size.width/2, y-size.height/2);
};
mindplot.ActionIcon.prototype.getPosition = function(){
return this._position;
};
mindplot.ActionIcon.prototype.addEventListener = function(event, fn){
this.getImage().addEventListener(event, fn);
};

View File

@@ -29,7 +29,7 @@ mindplot.ConnectionLine = function(sourceNode, targetNode, lineType)
var line;
if (targetNode.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
{
line = this._createLine(lineType,mindplot.ConnectionLine.SIMPLE_CURVED);
line = this._createLine(lineType,mindplot.ConnectionLine.CURVED);
// line = new web2d.Line();
if(line.getType()=="CurvedLine"){
var ctrlPoints = this._getCtrlPoints(sourceNode, targetNode);
@@ -86,7 +86,7 @@ mindplot.ConnectionLine.prototype._createLine = function(lineType, defaultStyle)
mindplot.ConnectionLine.getStrokeColor = function()
{
return '#495879';
return '#c8e794';
};
mindplot.ConnectionLine.prototype.setVisibility = function(value)

View File

@@ -189,12 +189,10 @@ mindplot.IconGroup.prototype.updateIconGroupPosition = function() {
mindplot.IconGroup.prototype._calculateOffsets = function() {
var offset = this.options.topic.getOffset();
/*var text = this.options.topic.getTextShape();
var text = this.options.topic.getTextShape();
var sizeHeight = text.getHtmlFontSize();
var yOffset = offset;
var shape = this.options.topic.getShapeType();
yOffset = text.getPosition().y + (sizeHeight - 18)/2 + 1;*/
var height = this.options.topic.getSize().height;
var yOffset = (height/2)-this.getSize().height/2;
yOffset = text.getPosition().y + (sizeHeight - 18)/2 + 1;
return {x:offset, y:yOffset};
};

View File

@@ -90,21 +90,8 @@ mindplot.RichTextEditor = mindplot.TextEditor.extend({
}
}.bind(this);
_animEffect = effect.periodical(10);
var text;
this._selectText=true;
if(this.initialText && this.initialText!="")
{
text = this.initialText;
this.initialText=null;
this._selectText=false;
}
else
text = node.getText();
$(this.inputText).value = text;
this._editor = new nicEditor({iconsPath: '../images/nicEditorIcons.gif', buttonList : ['bold','italic','underline','ol','ul','image','link','unlink','forecolor','removeformat','fontSize','fontFamily'], maxHeight:152}).panelInstance("inputText2");
this._editor.addEvent('key',function(instance,event){
console.log("key");
});
$(this.inputText).value = core.Utils.isDefined(this.initialText)&& this.initialText!=""? this.initialText: node.getText();
this._editor = new nicEditor({iconsPath: '../images/nicEditorIcons.gif', buttonList : ['bold','italic','underline','removeformat','forecolor', 'fontSize', 'fontFamily', 'xhtml']}).panelInstance("inputText2");
},
init:function(node){
this._currentNode = node;
@@ -112,21 +99,7 @@ mindplot.RichTextEditor = mindplot.TextEditor.extend({
$(this._myOverlay.setStyle('display','block'));
inst = this._editor.instanceById("inputText2");
inst.elm.focus();
if(this._selectText){
document.execCommand('selectAll', false, null);
}
else{
var length = $(this.inputText).value.length;
if (document.selection) {
var sel = document.selection.createRange();
sel.moveStart('character', length);
sel.select();
}
else {
sel = window.getSelection();
sel.collapse(inst.elm.firstChild, length);
}
}
//becarefull this._editor is not mootools!!
@@ -137,6 +110,7 @@ mindplot.RichTextEditor = mindplot.TextEditor.extend({
if(text!=this._text){
this.applyChanges = true;
}
console.log('bye');
this.lostFocusListener();
this._editor.removeInstance("inputText2");
this._editor.destruct();

View File

@@ -192,7 +192,7 @@ mindplot.TextEditor = new Class({
text = nodeText.getText();
var font = nodeText.getFont();
font.size = nodeText.getSize();
font.size = nodeText.getHtmlFontSize();
font.color = nodeText.getColor();
this.setStyle(font);

View File

@@ -189,7 +189,7 @@ mindplot.Topic.prototype.buildShape = function(attributes, type)
}
else if (type == mindplot.NodeModel.SHAPE_TYPE_LINE)
{
result = new web2d.Line({strokeColor:"#495879",strokeWidth:1, strokeOpacity:1});
result = new web2d.Line({strokeColor:"#c8e794",strokeWidth:1, strokeOpacity:1});
result.setSize = function(width, height)
{
this.size = {width:width, height:height};
@@ -440,7 +440,7 @@ mindplot.Topic.prototype.getRelationships = function(){
mindplot.Topic.prototype._buildTextShape = function(disableEventsListeners)
{
var result = new web2d.HtmlBox();
var result = new web2d.Text();
var font = {};
var family = this.getFontFamily();
@@ -1174,7 +1174,7 @@ mindplot.Topic.prototype.setSize = function(size, force, updatePosition)
// Update the figure position(ej: central topic must be centered) and children position.
this._updatePositionOnChangeSize(oldSize, size, updatePosition);
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeResizeEvent,[this, oldSize]);
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeResizeEvent,[this]);
}
};
@@ -1359,10 +1359,11 @@ mindplot.Topic.prototype.updateNode = function(updatePosition)
var textShape = this.getTextShape();
var sizeWidth = textShape.getWidth();
var sizeHeight = textShape.getHeight();
var font = textShape.getFont();
var iconOffset = this.getIconOffset();
var height = sizeHeight + this._offset;
var width = sizeWidth + this._offset*2 + iconOffset +2;
var pos = height/2 - sizeHeight/2;
var pos = this._offset /2 -1;
if(this.getShapeType()==mindplot.NodeModel.SHAPE_TYPE_ELIPSE){
var factor = 0.25;
height = (width*factor<height?height:width*factor);
@@ -1378,13 +1379,6 @@ mindplot.Topic.prototype.updateNode = function(updatePosition)
var iconGroup = this.getIconGroup();
if(core.Utils.isDefined(iconGroup))
iconGroup.updateIconGroupPosition();
//Positionate Helpers
this._helpers.forEach(function(helper){
var pos = helper.getPosition();
var x = width/2;
helper.setPosition(x, pos.y);
});
}
};

View File

@@ -89,7 +89,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
var text = topic.getText();
if (core.Utils.isDefined(text)) {
parentTopic.setAttribute('text', "<![CDATA["+text+"]]");
parentTopic.setAttribute('text', text);
}
var shape = topic.getShapeType();
@@ -276,9 +276,6 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
var text = domElem.getAttribute('text');
if (core.Utils.isDefined(text)) {
if(text.indexOf("<![CDATA[")!=-1){
text = text.substr(9,text.length-9-2);
}
topic.setText(text);
}

View File

@@ -15,7 +15,7 @@ mindplot.layoutManagers.BaseLayoutManager = new Class({
mindplot.EventBus.instance.addEvent(mindplot.EventBus.events.NodeRepositionateEvent,this._nodeRepositionateEvent.bind(this));
mindplot.EventBus.instance.addEvent(mindplot.EventBus.events.NodeShrinkEvent,this._nodeShrinkEvent.bind(this));
},
_nodeResizeEvent:function(node, oldSize){
_nodeResizeEvent:function(node){
},
_nodeMoveEvent:function(node){
var modifiedTopics = [];

View File

@@ -5,19 +5,6 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
initialize:function(designer, options){
this.parent(designer, options);
},
_nodeResizeEvent:function(node, oldSize){
var size = node.getSize();
var sign = -Math.sign(node.getPosition().x);
var delta = new core.Point((size.width-oldSize.width)*sign, (-size.height + oldSize.height)/2);
if(node.getParent()!=null){
var board = this.getTopicBoardForTopic(node.getParent());
var result = board.findNodeEntryIndex(node);
var entry = result.table[result.index];
entry.updateMinimumMargin();
}
this._updateChildrenBoards(node, delta, []);
this._updateBoard(node,[]);
},
_nodeConnectEvent:function(targetNode, node){
if(core.Utils.isDefined(node.relationship)){
this._movingNode(targetNode, node);
@@ -273,16 +260,11 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
}
},
_updateChildrenBoards:function(node, delta, modifiedTopics){
if(this._isCentralTopic(node)){
delta.x = delta.x/2;
}
var board = this.getTopicBoardForTopic(node);
board._positionTables.forEach(function(topics){
for(var i=0; i<topics.length; i++){
board._updateEntryPos(topics[i],delta, modifiedTopics, false);
}
});
var topics = board._getTableForNode(null);
for(var i=0; i<topics.length; i++){
board._updateEntryPos(topics[i],delta, modifiedTopics, false);
}
},
addHelpers:function(node){
if (node.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
@@ -503,7 +485,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
pos.y = Math.round(pos.y);
var nodePos = this.getPosition();
//if it is on the child half side, or it is central topic add it as child
if(!this.areChildrenShrinked() && (layoutManager._isCentralTopic(this) || this.getParent()==null || ((Math.sign(nodePos.x)>0 && pos.x>nodePos.x) || (Math.sign(nodePos.x)<0 && pos.x<nodePos.x)))){
if(layoutManager._isCentralTopic(this) || this.getParent()==null || ((Math.sign(nodePos.x)>0 && pos.x>nodePos.x) || (Math.sign(nodePos.x)<0 && pos.x<nodePos.x))){
layoutManager._updateIndicatorShapes(this, mindplot.layoutManagers.FreeMindLayoutManager.RECONNECT_SHAPE_CHILD, pos);
}else{
//is a sibling. if mouse in top half sibling goes above this one

View File

@@ -19,7 +19,8 @@ mindplot.layoutManagers.boards.freeMindBoards.Entry = new Class({
}
}
this._DEFAULT_GAP = 10;
this.updateMinimumMargin();
var height = this.getNode().getSize().height;
this._minimalMargin = this._DEFAULT_GAP + height/2;
this._marginTop = this._minimalMargin;
this._marginBottom = this._minimalMargin;
this._marginTopChildren=0;
@@ -84,15 +85,5 @@ mindplot.layoutManagers.boards.freeMindBoards.Entry = new Class({
},
getTotalMarginBottom:function(){
return (this._node.areChildrenShrinked()?0:this._marginBottomChildren) + this._marginBottom;
},
updateMinimumMargin:function(){
var height = this.getNode().getSize().height;
this._minimalMargin = this._DEFAULT_GAP + height/2;
if(this.getMarginTop()<this._minimalMargin){
this.setMarginTop(this._minimalMargin);
}
if(this.getMarginBottom()<this._minimalMargin){
this.setMarginBottom(this._minimalMargin);
}
}
});