Add publish map on editor.
This commit is contained in:
@@ -96,11 +96,11 @@ mindplot.ControlPoint = new Class({
|
||||
var pos = screen.getWorkspaceMousePosition(event);
|
||||
var topic = null;
|
||||
if (point == 0) {
|
||||
var cords = core.Utils.calculateRelationShipPointCoordinates(this._line.getSourceTopic(), pos);
|
||||
var cords = mindplot.util.Shape.calculateRelationShipPointCoordinates(this._line.getSourceTopic(), pos);
|
||||
this._line.setFrom(cords.x, cords.y);
|
||||
this._line.setSrcControlPoint(new core.Point(pos.x - cords.x, pos.y - cords.y));
|
||||
} else {
|
||||
var cords = core.Utils.calculateRelationShipPointCoordinates(this._line.getTargetTopic(), pos);
|
||||
var cords = mindplot.util.Shape.calculateRelationShipPointCoordinates(this._line.getTargetTopic(), pos);
|
||||
this._line.setTo(cords.x, cords.y);
|
||||
this._line.setDestControlPoint(new core.Point(pos.x - cords.x, pos.y - cords.y));
|
||||
}
|
||||
|
@@ -51,7 +51,9 @@ mindplot.LocalStorageManager = new Class({
|
||||
}
|
||||
|
||||
}
|
||||
return core.Utils.createDocumentFromText(xml);
|
||||
|
||||
var parser = new DOMParser();
|
||||
return parser.parseFromString(xml, "text/xml");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@@ -60,7 +60,7 @@ mindplot.RelationshipLine = new Class({
|
||||
this._line2d.setStroke(2);
|
||||
var ctrlPoints = this._line2d.getControlPoints();
|
||||
if (!this._line2d.isDestControlPointCustom() && !this._line2d.isSrcControlPointCustom()) {
|
||||
var defaultPoints = core.Utils.calculateDefaultControlPoints(sourcePosition, targetPosition);
|
||||
var defaultPoints = mindplot.util.Shape.calculateDefaultControlPoints(sourcePosition, targetPosition);
|
||||
ctrlPoints[0].x = defaultPoints[0].x;
|
||||
ctrlPoints[0].y = defaultPoints[0].y;
|
||||
ctrlPoints[1].x = defaultPoints[1].x;
|
||||
@@ -73,8 +73,8 @@ mindplot.RelationshipLine = new Class({
|
||||
var tpoint = new core.Point();
|
||||
tpoint.x = parseInt(ctrlPoints[1].x) + parseInt(targetPosition.x);
|
||||
tpoint.y = parseInt(ctrlPoints[1].y) + parseInt(targetPosition.y);
|
||||
sPos = core.Utils.calculateRelationShipPointCoordinates(sourceTopic, spoint);
|
||||
tPos = core.Utils.calculateRelationShipPointCoordinates(targetTopic, tpoint);
|
||||
sPos = mindplot.util.Shape.calculateRelationShipPointCoordinates(sourceTopic, spoint);
|
||||
tPos = mindplot.util.Shape.calculateRelationShipPointCoordinates(targetTopic, tpoint);
|
||||
|
||||
line2d.setFrom(sPos.x, sPos.y);
|
||||
line2d.setTo(tPos.x, tPos.y);
|
||||
|
@@ -42,11 +42,10 @@ var MooDialog = new Class({
|
||||
options = this.options;
|
||||
|
||||
var wrapper = this.wrapper = new Element('div.' + options['class'].replace(' ', '.')).inject(options.inject);
|
||||
this.content = new Element('div.content').inject(wrapper);
|
||||
|
||||
if (options.title){
|
||||
this.title = new Element('div.title').set('text', options.title).inject(wrapper);
|
||||
wrapper.addClass('MooDialogTitle');
|
||||
// this.title.addClass('MooDialogTitle');
|
||||
}
|
||||
|
||||
if (options.closeButton){
|
||||
@@ -54,6 +53,7 @@ var MooDialog = new Class({
|
||||
events: {click: this.close.bind(this)}
|
||||
}).inject(wrapper);
|
||||
}
|
||||
this.content = new Element('div.content').inject(wrapper);
|
||||
|
||||
|
||||
/*<ie6>*/// IE 6 scroll
|
||||
|
@@ -41,6 +41,57 @@ mindplot.util.Shape =
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
calculateRelationShipPointCoordinates : function(topic, controlPoint) {
|
||||
var size = topic.getSize();
|
||||
var position = topic.getPosition();
|
||||
var m = (position.y - controlPoint.y) / (position.x - controlPoint.x);
|
||||
var y,x;
|
||||
var gap = 5;
|
||||
if (controlPoint.y > position.y + (size.height / 2)) {
|
||||
y = position.y + (size.height / 2) + gap;
|
||||
x = position.x - ((position.y - y) / m);
|
||||
if (x > position.x + (size.width / 2)) {
|
||||
x = position.x + (size.width / 2);
|
||||
} else if (x < position.x - (size.width / 2)) {
|
||||
x = position.x - (size.width / 2);
|
||||
}
|
||||
} else if (controlPoint.y < position.y - (size.height / 2)) {
|
||||
y = position.y - (size.height / 2) - gap;
|
||||
x = position.x - ((position.y - y) / m);
|
||||
if (x > position.x + (size.width / 2)) {
|
||||
x = position.x + (size.width / 2);
|
||||
} else if (x < position.x - (size.width / 2)) {
|
||||
x = position.x - (size.width / 2);
|
||||
}
|
||||
} else if (controlPoint.x < (position.x - size.width / 2)) {
|
||||
x = position.x - (size.width / 2) - gap;
|
||||
y = position.y - (m * (position.x - x));
|
||||
} else {
|
||||
x = position.x + (size.width / 2) + gap;
|
||||
y = position.y - (m * (position.x - x));
|
||||
}
|
||||
|
||||
return new core.Point(x, y);
|
||||
},
|
||||
|
||||
calculateDefaultControlPoints : function(srcPos, tarPos) {
|
||||
var y = srcPos.y - tarPos.y;
|
||||
var x = srcPos.x - tarPos.x;
|
||||
var m = y / x;
|
||||
var l = Math.sqrt(y * y + x * x) / 3;
|
||||
var fix = 1;
|
||||
if (srcPos.x > tarPos.x) {
|
||||
fix = -1;
|
||||
}
|
||||
|
||||
var x1 = srcPos.x + Math.sqrt(l * l / (1 + (m * m))) * fix;
|
||||
var y1 = m * (x1 - srcPos.x) + srcPos.y;
|
||||
var x2 = tarPos.x + Math.sqrt(l * l / (1 + (m * m))) * fix * -1;
|
||||
var y2 = m * (x2 - tarPos.x) + tarPos.y;
|
||||
|
||||
return [new core.Point(-srcPos.x + x1, -srcPos.y + y1),new core.Point(-tarPos.x + x2, -tarPos.y + y2)];
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -61,7 +61,7 @@ mindplot.widget.LinkIconTooltip = new Class({
|
||||
var imgContainer = new Element('div');
|
||||
imgContainer.setStyles({
|
||||
width: '100%',
|
||||
textAlign: 'center',
|
||||
textAlign: 'right',
|
||||
'padding-bottom':'5px',
|
||||
'padding-top': '5px'
|
||||
});
|
||||
|
@@ -193,7 +193,7 @@ mindplot.widget.Menu = new Class({
|
||||
|
||||
this._addButton('export', false, false, function() {
|
||||
var reqDialog = new MooDialog.Request('c/map/' + mapId + '/export.htm', null,
|
||||
{'class': 'exportModalDialog',
|
||||
{'class': 'modalDialog exportModalDialog',
|
||||
closeButton:true,
|
||||
destroyOnClose:true,
|
||||
title:'Export'
|
||||
@@ -317,7 +317,7 @@ mindplot.widget.Menu = new Class({
|
||||
if (tagElem) {
|
||||
this._addButton('tagIt', false, false, function() {
|
||||
var reqDialog = new MooDialog.Request('c/tags.htm?mapId=' + mapId, null,
|
||||
{'class': 'tagItModalDialog',
|
||||
{'class': 'modalDialog tagItModalDialog',
|
||||
closeButton:true,
|
||||
destroyOnClose:true,
|
||||
title:'Tags'
|
||||
@@ -335,7 +335,7 @@ mindplot.widget.Menu = new Class({
|
||||
if (shareElem) {
|
||||
this._addButton('shareIt', false, false, function() {
|
||||
var reqDialog = new MooDialog.Request('c/mymaps.htm?action=collaborator&mapId=' + mapId, null,
|
||||
{'class': 'shareItModalDialog',
|
||||
{'class': 'modalDialog shareItModalDialog',
|
||||
closeButton:true,
|
||||
destroyOnClose:true,
|
||||
title:'Share It'
|
||||
@@ -354,8 +354,8 @@ mindplot.widget.Menu = new Class({
|
||||
var publishElem = $('publishIt');
|
||||
if (publishElem) {
|
||||
this._addButton('publishIt', false, false, function() {
|
||||
var reqDialog = new MooDialog.Request('c/publish.htm?mapId=' + mapId, null,
|
||||
{'class': 'publishModalDialog',
|
||||
var reqDialog = new MooDialog.Request('c/iframeWrapper.htm?url=c/maps/' + mapId + "/publishf.htm", null,
|
||||
{'class': 'modalDialog publishModalDialog',
|
||||
closeButton:true,
|
||||
destroyOnClose:true,
|
||||
title:'Publish'
|
||||
@@ -365,6 +365,7 @@ mindplot.widget.Menu = new Class({
|
||||
reqDialog.setContent('loading...');
|
||||
}
|
||||
});
|
||||
MooDialog.Request.active = reqDialog;
|
||||
|
||||
});
|
||||
this._registerTooltip('publishIt', "Publish");
|
||||
@@ -375,7 +376,7 @@ mindplot.widget.Menu = new Class({
|
||||
|
||||
this._addButton('history', false, false, function() {
|
||||
var reqDialog = new MooDialog.Request('c/history.htm?action=list&goToMindmapList&mapId=' + mapId, null,
|
||||
{'class': 'historyModalDialog',
|
||||
{'class': 'modalDialog historyModalDialog',
|
||||
closeButton:true,
|
||||
destroyOnClose:true,
|
||||
title:'History'
|
||||
|
@@ -93,7 +93,7 @@ mindplot.widget.NoteEditor = new Class({
|
||||
}.bind(this));
|
||||
|
||||
// Add buttons ...
|
||||
var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'center'});
|
||||
var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'right'});
|
||||
|
||||
// Create accept button ...
|
||||
var okButton = new Element('input', {type:'submit', value:'Accept','class':'btn-primary'});
|
||||
@@ -113,7 +113,6 @@ mindplot.widget.NoteEditor = new Class({
|
||||
buttonContainer.inject(form);
|
||||
}
|
||||
|
||||
|
||||
// Create cancel button ...
|
||||
var cButton = new Element('input', {type:'button', value:'Cancel','class':'btn-secondary'});
|
||||
cButton.setStyle('margin', '5px');
|
||||
|
Reference in New Issue
Block a user