diff --git a/mindplot/pom.xml b/mindplot/pom.xml
index 189e7f07..beeee7e3 100644
--- a/mindplot/pom.xml
+++ b/mindplot/pom.xml
@@ -170,7 +170,7 @@
-
+
diff --git a/mindplot/src/main/javascript/MindmapDesigner.js b/mindplot/src/main/javascript/MindmapDesigner.js
index 645b930e..1550a056 100644
--- a/mindplot/src/main/javascript/MindmapDesigner.js
+++ b/mindplot/src/main/javascript/MindmapDesigner.js
@@ -33,8 +33,8 @@ mindplot.MindmapDesigner = new Class({
this._model = new mindplot.DesignerModel(profile);
// Init Screen manager..
- var screenManager = new mindplot.ScreenManager(profile.width, profile.height, divElement);
- this._workspace = new mindplot.Workspace(profile, screenManager, this._model.getZoom());
+ var screenManager = new mindplot.ScreenManager(divElement);
+ this._workspace = new mindplot.Workspace(screenManager, this._model.getZoom());
this._readOnly = profile.readOnly ? true : false;
// Init layout managers ...
@@ -77,7 +77,8 @@ mindplot.MindmapDesigner = new Class({
});
// Clean some selected nodes on event ..
- this._cleanScreen();
+ if (this._cleanScreen)
+ this._cleanScreen();
}.bind(this));
@@ -129,6 +130,9 @@ mindplot.MindmapDesigner = new Class({
}
},
+ setViewPort : function(size) {
+ this._workspace.setViewPort(size);
+ },
_buildNodeGraph : function(model) {
var workspace = this._workspace;
@@ -761,8 +765,8 @@ mindplot.MindmapDesigner = new Class({
addNote : function() {
var model = this.getModel();
var topic = model.selectedTopic();
- if (topic!=null) {
- topic.showNoteEditor();
+ if (topic != null) {
+ topic.showNoteEditor();
} else {
core.Monitor.getInstance().logMessage('At least one topic must be selected to execute this operation.');
}
diff --git a/mindplot/src/main/javascript/ScreenManager.js b/mindplot/src/main/javascript/ScreenManager.js
index 7556d4aa..5272e8fb 100644
--- a/mindplot/src/main/javascript/ScreenManager.js
+++ b/mindplot/src/main/javascript/ScreenManager.js
@@ -17,14 +17,16 @@
*/
mindplot.ScreenManager = new Class({
- initialize:function(width, height, divElement) {
+ initialize:function(divElement) {
$assert(divElement, "can not be null");
this._divContainer = divElement;
this._offset = {x:0,y:0};
// Ignore default click event propagation. Prevent 'click' event on drad.
this._clickEvents = [];
- this._divContainer.addEvent('click',function(event){event.stopPropagation()});
+ this._divContainer.addEvent('click', function(event) {
+ event.stopPropagation()
+ });
// @Todo: This must be resolved in other way ...
mindplot.util.Converter.setScreenManager(this);
@@ -51,9 +53,8 @@ mindplot.ScreenManager = new Class({
fireEvent : function(type, event) {
if (type == 'click') {
- this._clickEvents.forEach(function(listener)
- {
- listener(type,event);
+ this._clickEvents.forEach(function(listener) {
+ listener(type, event);
});
}
else {
@@ -150,4 +151,5 @@ mindplot.ScreenManager = new Class({
setOffset : function(x, y) {
this._offset.x = x;
this._offset.y = y;
- }});
+ }
+});
diff --git a/mindplot/src/main/javascript/Topic.js b/mindplot/src/main/javascript/Topic.js
index 97e7caf1..5a041e75 100644
--- a/mindplot/src/main/javascript/Topic.js
+++ b/mindplot/src/main/javascript/Topic.js
@@ -780,7 +780,7 @@ mindplot.Topic = new Class({
}
};
- var editor = new mindplot.widget.EditNoteDialog(editorModel);
+ var editor = new mindplot.widget.NoteEditor(editorModel);
editor.show();
},
diff --git a/mindplot/src/main/javascript/Workspace.js b/mindplot/src/main/javascript/Workspace.js
index 32c909aa..9b62c74d 100644
--- a/mindplot/src/main/javascript/Workspace.js
+++ b/mindplot/src/main/javascript/Workspace.js
@@ -17,41 +17,32 @@
*/
mindplot.Workspace = new Class({
- initialize: function(profile, screenManager, zoom) {
+ initialize: function(screenManager, zoom) {
// Create a suitable container ...
$assert(screenManager, 'Div container can not be null');
+ $assert(zoom, 'zoom container can not be null');
+
this._zoom = zoom;
this._screenManager = screenManager;
- this._screenWidth = profile.width;
- this._screenHeight = profile.height;
- // Initalize web2d workspace.
- var workspace = this._createWorkspace(profile);
+ var divContainer = screenManager.getContainer();
+ this._screenWidth = parseInt(divContainer.getStyle('width'));
+ this._screenHeight = parseInt(divContainer.getStyle('height'));
+
+ // Initialize web2d workspace.
+ var workspace = this._createWorkspace();
this._workspace = workspace;
- var screenContainer = screenManager.getContainer();
- // Fix the height of the container ....
- screenContainer.style.height = this._screenHeight + "px";
-
// Append to the workspace...
- workspace.addItAsChildTo(screenContainer);
+ workspace.addItAsChildTo(divContainer);
this.setZoom(zoom, true);
// Register drag events ...
this._registerDragEvents();
- this._eventsEnabled = true;
+ this._eventsEnabled = true;
},
- _updateScreenManager: function() {
- var zoom = this._zoom;
- this._screenManager.setScale(zoom);
-
- var coordOriginX = -((this._screenWidth * this._zoom) / 2);
- var coordOriginY = -((this._screenHeight * this._zoom) / 2);
- this._screenManager.setOffset(coordOriginX, coordOriginY);
- },
-
- _createWorkspace: function(profile) {
+ _createWorkspace: function() {
// Initialize workspace ...
var coordOriginX = -(this._screenWidth / 2);
var coordOriginY = -(this._screenHeight / 2);
@@ -111,7 +102,11 @@ mindplot.Workspace = new Class({
// Center topic....
var coordOriginX;
var coordOriginY;
- if (center) {
+
+ if (center && this._viewPort) {
+ coordOriginX = -(this._viewPort.width / 2);
+ coordOriginY = -(this._viewPort.height / 2);
+ } else if (center) {
coordOriginX = -(coordWidth / 2);
coordOriginY = -(coordHeight / 2);
} else {
@@ -212,6 +207,11 @@ mindplot.Workspace = new Class({
}
};
screenManager.addEvent('mousedown', mouseDownListener);
+ },
+
+ setViewPort : function(size) {
+ this._viewPort = size;
+ this.setZoom(this._zoom, true);
}
});
diff --git a/mindplot/src/main/javascript/widget/Menu.js b/mindplot/src/main/javascript/widget/Menu.js
index 9954133d..352539de 100644
--- a/mindplot/src/main/javascript/widget/Menu.js
+++ b/mindplot/src/main/javascript/widget/Menu.js
@@ -189,50 +189,56 @@ mindplot.widget.Menu = new Class({
// Register Events ...
- $('zoomIn').addEvent('click', function(event) {
+ $('zoomIn').addEvent('click', function() {
+ this.clear();
designer.zoomIn();
- });
+ }.bind(this));
- $('zoomOut').addEvent('click', function(event) {
+ $('zoomOut').addEvent('click', function() {
+ this.clear();
designer.zoomOut();
- });
+ }.bind(this));
- $('undoEdition').addEvent('click', function(event) {
+ $('undoEdition').addEvent('click', function() {
+ this.clear();
designer.undo();
- });
+ }.bind(this));
- $('redoEdition').addEvent('click', function(event) {
+ $('redoEdition').addEvent('click', function() {
+ this.clear();
designer.redo();
- });
+ }.bind(this));
- $('addTopic').addEvent('click', function(event) {
+ $('addTopic').addEvent('click', function() {
+ this.clear();
designer.createSiblingForSelectedNode();
- });
+ }.bind(this));
- $('deleteTopic').addEvent('click', function(event) {
+ $('deleteTopic').addEvent('click', function() {
+ this.clear();
designer.deleteCurrentNode();
- });
+ }.bind(this));
- $('topicLink').addEvent('click', function(event) {
+ $('topicLink').addEvent('click', function() {
+ this.clear();
designer.addLink();
-
- });
+ }.bind(this));
$('topicRelation').addEvent('click', function(event) {
designer.addRelationShip(event);
});
- $('topicNote').addEvent('click', function(event) {
+ $('topicNote').addEvent('click', function() {
+ this.clear();
designer.addNote();
+ }.bind(this));
- });
-
- $('fontBold').addEvent('click', function(event) {
+ $('fontBold').addEvent('click', function() {
designer.changeFontWeight();
});
- $('fontItalic').addEvent('click', function(event) {
+ $('fontItalic').addEvent('click', function() {
designer.changeFontStyle();
});
diff --git a/mindplot/src/main/javascript/widget/EditNoteDialog.js b/mindplot/src/main/javascript/widget/NoteEditor.js
similarity index 98%
rename from mindplot/src/main/javascript/widget/EditNoteDialog.js
rename to mindplot/src/main/javascript/widget/NoteEditor.js
index 594b16a8..de5a83d7 100644
--- a/mindplot/src/main/javascript/widget/EditNoteDialog.js
+++ b/mindplot/src/main/javascript/widget/NoteEditor.js
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-mindplot.widget.EditNoteDialog = new Class({
+mindplot.widget.NoteEditor = new Class({
Extends:MooDialog,
initialize : function(model) {
$assert(model, "model can not be null");
diff --git a/web2d/src/main/javascript/Workspace.js b/web2d/src/main/javascript/Workspace.js
index b979a12e..075965b1 100644
--- a/web2d/src/main/javascript/Workspace.js
+++ b/web2d/src/main/javascript/Workspace.js
@@ -29,40 +29,10 @@ web2d.Workspace = function(attributes)
}
web2d.Element.call(this, peer, defaultAttributes);
this._htmlContainer.appendChild(this._peer._native);
-
- this._disableTextSelection();
};
objects.extend(web2d.Workspace, web2d.Element);
-/**
- * Avoid element selection. This remove some odd effect in IE when a element is draged.
- */
-web2d.Workspace.prototype._disableTextSelection = function()
-{
- var contaier = this._htmlContainer;
-
- function disabletext(e) {
- return false;
- }
- ;
-
- function reEnable() {
- return true;
- }
- ;
-
- //if the browser is IE4+
- contaier.onselectstart = new Function("return false");
-
- //if the browser is NS6
- if ($defined(window.sidebar))
- {
- contaier.onmousedown = disabletext;
- contaier.onclick = reEnable;
- }
- ;
-};
web2d.Workspace.prototype.getType = function()
{
@@ -104,7 +74,7 @@ web2d.Workspace.prototype.addItAsChildTo = function(element)
};
/**
- * Create a new div element that will be resposible for containing the workspace elements.
+ * Create a new div element that will be responsible for containing the workspace elements.
*/
web2d.Workspace.prototype._createDivContainer = function(domElement)
{
diff --git a/wise-doc/src/main/webapp/html/editor.html b/wise-doc/src/main/webapp/html/editor.html
index 723f624f..779f90ec 100644
--- a/wise-doc/src/main/webapp/html/editor.html
+++ b/wise-doc/src/main/webapp/html/editor.html
@@ -106,7 +106,7 @@
-