Improve toolbar and editor size.
This commit is contained in:
@@ -55,9 +55,12 @@ mindplot.IconGroup = new Class({
|
||||
},
|
||||
|
||||
addIcon : function(icon) {
|
||||
$defined(icon,"icon is not defined");
|
||||
icon.setGroup(this);
|
||||
|
||||
var newIcon = icon.getImage();
|
||||
var nativeElem = this.options.nativeElem;
|
||||
|
||||
var iconSize = newIcon.getSize();
|
||||
var size = nativeElem.getSize();
|
||||
newIcon.setPosition(size.width, 0);
|
||||
@@ -186,8 +189,10 @@ mindplot.IconGroup = new Class({
|
||||
_calculateOffsets : function() {
|
||||
var offset = this.options.topic.getOffset();
|
||||
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;
|
||||
return {x:offset, y:yOffset};
|
||||
|
@@ -22,6 +22,7 @@ mindplot.ImageIcon = new Class({
|
||||
$assert(iconModel, 'iconModel can not be null');
|
||||
$assert(topic, 'topic can not be null');
|
||||
$assert(designer, 'designer can not be null');
|
||||
|
||||
this._topic = topic;
|
||||
this._iconModel = iconModel;
|
||||
this._designer = designer;
|
||||
@@ -47,11 +48,12 @@ mindplot.ImageIcon = new Class({
|
||||
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
||||
actionDispatcher.removeIconFromTopic(this._topic.getId(), iconModel);
|
||||
tip.forceClose();
|
||||
}.bindWithEvent(this));
|
||||
});
|
||||
|
||||
//Icon
|
||||
var image = this.getImage();
|
||||
image.addEventListener('click', function() {
|
||||
|
||||
var iconType = iconModel.getIconType();
|
||||
var newIconType = this._getNextFamilyIconId(iconType);
|
||||
iconModel.setIconType(newIconType);
|
||||
@@ -59,21 +61,16 @@ mindplot.ImageIcon = new Class({
|
||||
var imgUrl = this._getImageUrl(newIconType);
|
||||
this._image.setHref(imgUrl);
|
||||
|
||||
// // @Todo: Support revert of change icon ...
|
||||
// var actionRunner = designer._actionRunner;
|
||||
// var command = new mindplot.commands.ChangeIconFromTopicCommand(this._topic.getId());
|
||||
// this._actionRunner.execute(command);
|
||||
}.bind(this));
|
||||
|
||||
|
||||
}.bindWithEvent(this));
|
||||
|
||||
var imageIcon = this;
|
||||
image.addEventListener('mouseover', function(event) {
|
||||
tip.open(event, container, imageIcon);
|
||||
});
|
||||
tip.open(event, container, this);
|
||||
}.bind(this));
|
||||
|
||||
image.addEventListener('mouseout', function(event) {
|
||||
tip.close(event);
|
||||
});
|
||||
|
||||
image.addEventListener('mousemove', function(event) {
|
||||
tip.updatePosition(event);
|
||||
});
|
||||
|
@@ -20,7 +20,12 @@ mindplot.LocalActionDispatcher = new Class({
|
||||
Extends: mindplot.ActionDispatcher,
|
||||
initialize: function(commandContext) {
|
||||
this.parent(commandContext);
|
||||
this._actionRunner = new mindplot.DesignerActionRunner(commandContext,this);
|
||||
this._actionRunner = new mindplot.DesignerActionRunner(commandContext, this);
|
||||
},
|
||||
|
||||
hasBeenChanged: function() {
|
||||
// @todo: This don't seems to belong here.
|
||||
this._actionRunner.hasBeenChanged();
|
||||
},
|
||||
|
||||
addIconToTopic: function(topicId, iconType) {
|
||||
|
@@ -64,9 +64,7 @@ mindplot.MindmapDesigner = new Class({
|
||||
},
|
||||
|
||||
addEventListener : function(eventType, listener) {
|
||||
|
||||
this._events[eventType] = listener;
|
||||
|
||||
},
|
||||
|
||||
_fireEvent : function(eventType, event) {
|
||||
@@ -86,7 +84,7 @@ mindplot.MindmapDesigner = new Class({
|
||||
// Create nodes on double click...
|
||||
screenManager.addEventListener('click', function(event) {
|
||||
if (workspace.isWorkspaceEventsEnabled()) {
|
||||
var t = mindmapDesigner.getEditor().isVisible();
|
||||
mindmapDesigner.getEditor().isVisible();
|
||||
mindmapDesigner.getEditor().lostFocus();
|
||||
// @todo: Puaj hack...
|
||||
mindmapDesigner._cleanScreen();
|
||||
@@ -157,14 +155,14 @@ mindplot.MindmapDesigner = new Class({
|
||||
onObjectFocusEvent : function(currentObject, event) {
|
||||
this.getEditor().lostFocus();
|
||||
var selectableObjects = this.getSelectedObjects();
|
||||
|
||||
// Disable all nodes on focus but not the current if Ctrl key isn't being pressed
|
||||
if (!$defined(event) || event.ctrlKey) {
|
||||
for (var i = 0; i < selectableObjects.length; i++) {
|
||||
var selectableObject = selectableObjects[i];
|
||||
if (!$defined(event) || event.ctrlKey == false) {
|
||||
selectableObjects.forEach(function(selectableObject) {
|
||||
if (selectableObject.isOnFocus() && selectableObject != currentObject) {
|
||||
selectableObject.setOnFocus(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -351,7 +349,8 @@ mindplot.MindmapDesigner = new Class({
|
||||
|
||||
this._fireEvent("loadsuccess");
|
||||
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
load : function(mapId) {
|
||||
$assert(mapId, 'mapName can not be null');
|
||||
@@ -370,7 +369,8 @@ mindplot.MindmapDesigner = new Class({
|
||||
this._goToNode.attempt(centralTopic, this);
|
||||
|
||||
this._fireEvent("loadsuccess");
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
_loadMap : function(mapId, mindmapModel) {
|
||||
var designer = this;
|
||||
@@ -383,7 +383,7 @@ mindplot.MindmapDesigner = new Class({
|
||||
for (var i = 0; i < branches.length; i++) {
|
||||
// NodeModel -> NodeGraph ...
|
||||
var nodeModel = branches[i];
|
||||
var nodeGraph = this._nodeModelToNodeGraph(nodeModel);
|
||||
var nodeGraph = this._nodeModelToNodeGraph(nodeModel, false);
|
||||
|
||||
// Update shrink render state...
|
||||
nodeGraph.setBranchVisibility(true);
|
||||
@@ -399,42 +399,46 @@ mindplot.MindmapDesigner = new Class({
|
||||
});
|
||||
this._fireEvent("loadsuccess");
|
||||
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
|
||||
getMindmap : function() {
|
||||
return this._mindmap;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
undo : function() {
|
||||
this._actionRunner.undo();
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
redo : function() {
|
||||
this._actionRunner.redo();
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
_nodeModelToNodeGraph : function(nodeModel, isVisible) {
|
||||
$assert(nodeModel, "Node model can not be null");
|
||||
var nodeGraph = this._buildNodeGraph(nodeModel);
|
||||
|
||||
if ($defined(isVisible))
|
||||
if (isVisible)
|
||||
nodeGraph.setVisibility(isVisible);
|
||||
|
||||
var children = nodeModel.getChildren().slice();
|
||||
|
||||
children = this._layoutManager.prepareNode(nodeGraph, children);
|
||||
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
if ($defined(child))
|
||||
this._nodeModelToNodeGraph(child);
|
||||
this._nodeModelToNodeGraph(child, false);
|
||||
}
|
||||
|
||||
var workspace = this._workspace;
|
||||
workspace.appendChild(nodeGraph);
|
||||
return nodeGraph;
|
||||
},
|
||||
}
|
||||
,
|
||||
|
||||
_relationshipModelToRelationship : function(model) {
|
||||
$assert(model, "Node model can not be null");
|
||||
@@ -467,7 +471,6 @@ mindplot.MindmapDesigner = new Class({
|
||||
},
|
||||
|
||||
_buildRelationship : function (model) {
|
||||
var workspace = this._workspace;
|
||||
var elem = this;
|
||||
|
||||
var fromNodeId = model.getFromNode();
|
||||
@@ -508,7 +511,6 @@ mindplot.MindmapDesigner = new Class({
|
||||
relationLine.setModel(model);
|
||||
|
||||
//Add Listeners
|
||||
var elem = this;
|
||||
relationLine.addEventListener('onfocus', function(event) {
|
||||
elem.onObjectFocusEvent.attempt([relationLine, event], elem);
|
||||
});
|
||||
@@ -850,6 +852,8 @@ mindplot.MindmapDesigner = new Class({
|
||||
this._showEditor(key);
|
||||
}
|
||||
else {
|
||||
var nodes;
|
||||
var node;
|
||||
switch (key) {
|
||||
case 'delete':
|
||||
this.deleteCurrentNode();
|
||||
@@ -863,9 +867,9 @@ mindplot.MindmapDesigner = new Class({
|
||||
this.createChildForSelectedNode();
|
||||
break;
|
||||
case 'right':
|
||||
var nodes = this._getSelectedNodes();
|
||||
nodes = this._getSelectedNodes();
|
||||
if (nodes.length > 0) {
|
||||
var node = nodes[0];
|
||||
node = nodes[0];
|
||||
if (node.getTopicType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
this._goToSideChild(node, 'RIGHT');
|
||||
}
|
||||
@@ -880,9 +884,9 @@ mindplot.MindmapDesigner = new Class({
|
||||
}
|
||||
break;
|
||||
case 'left':
|
||||
var nodes = this._getSelectedNodes();
|
||||
nodes = this._getSelectedNodes();
|
||||
if (nodes.length > 0) {
|
||||
var node = nodes[0];
|
||||
node = nodes[0];
|
||||
if (node.getTopicType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
this._goToSideChild(node, 'LEFT');
|
||||
}
|
||||
@@ -897,18 +901,18 @@ mindplot.MindmapDesigner = new Class({
|
||||
}
|
||||
break;
|
||||
case'up':
|
||||
var nodes = this._getSelectedNodes();
|
||||
nodes = this._getSelectedNodes();
|
||||
if (nodes.length > 0) {
|
||||
var node = nodes[0];
|
||||
node = nodes[0];
|
||||
if (node.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
this._goToBrother(node, 'UP');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'down':
|
||||
var nodes = this._getSelectedNodes();
|
||||
nodes = this._getSelectedNodes();
|
||||
if (nodes.length > 0) {
|
||||
var node = nodes[0];
|
||||
node = nodes[0];
|
||||
if (node.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
this._goToBrother(node, 'DOWN');
|
||||
}
|
||||
@@ -918,8 +922,7 @@ mindplot.MindmapDesigner = new Class({
|
||||
this._showEditor();
|
||||
break;
|
||||
case 'space':
|
||||
|
||||
var nodes = this._getSelectedNodes();
|
||||
nodes = this._getSelectedNodes();
|
||||
if (nodes.length > 0) {
|
||||
var topic = nodes[0];
|
||||
|
||||
@@ -932,9 +935,9 @@ mindplot.MindmapDesigner = new Class({
|
||||
evt.preventDefault();
|
||||
break;
|
||||
case 'esc':
|
||||
var nodes = this._getSelectedNodes();
|
||||
nodes = this._getSelectedNodes();
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var node = nodes[i];
|
||||
node = nodes[i];
|
||||
node.setOnFocus(false);
|
||||
}
|
||||
break;
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
mindplot.NodeGraph = new Class({
|
||||
initialize:function(nodeModel) {
|
||||
$assert(nodeModel,"model can not be null");
|
||||
$assert(nodeModel, "model can not be null");
|
||||
this._mouseEvents = true;
|
||||
this.setModel(nodeModel);
|
||||
this._onFocus = false;
|
||||
@@ -74,13 +74,10 @@ mindplot.NodeGraph = new Class({
|
||||
this._model.setSize(size.width, size.height);
|
||||
},
|
||||
|
||||
getModel
|
||||
:
|
||||
function() {
|
||||
$assert(this._model, 'Model has not been initialized yet');
|
||||
return this._model;
|
||||
}
|
||||
,
|
||||
getModel:function() {
|
||||
$assert(this._model, 'Model has not been initialized yet');
|
||||
return this._model;
|
||||
},
|
||||
|
||||
setModel : function(model) {
|
||||
$assert(model, 'Model can not be null');
|
||||
|
@@ -30,8 +30,7 @@ mindplot.Topic = new Class({
|
||||
this._buildShape();
|
||||
this.setMouseEventsEnabled(true);
|
||||
|
||||
// Positionate topic ....
|
||||
var model = this.getModel();
|
||||
// Position a topic ....
|
||||
var pos = model.getPosition();
|
||||
if (pos != null && model.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
this.setPosition(pos);
|
||||
@@ -65,8 +64,8 @@ mindplot.Topic = new Class({
|
||||
|
||||
//Let's register all the events. The first one is the default one. The others will be copied.
|
||||
//this._registerDefaultListenersToElement(innerShape, this);
|
||||
|
||||
var dispatcher = dispatcherByEventType['mousedown'];
|
||||
|
||||
if ($defined(dispatcher)) {
|
||||
for (var i = 1; i < dispatcher._listeners.length; i++) {
|
||||
innerShape.addEventListener('mousedown', dispatcher._listeners[i]);
|
||||
@@ -245,7 +244,7 @@ mindplot.Topic = new Class({
|
||||
return this._icon;
|
||||
},
|
||||
|
||||
_buildIconGroup : function(disableEventsListeners) {
|
||||
_buildIconGroup : function() {
|
||||
var result = new mindplot.IconGroup(this);
|
||||
var model = this.getModel();
|
||||
|
||||
@@ -455,16 +454,6 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
model.setFontFamily(value);
|
||||
}
|
||||
/*var elem = this;
|
||||
var executor = function(editor)
|
||||
{
|
||||
return function()
|
||||
{
|
||||
elem.updateNode(updateModel);
|
||||
};
|
||||
};
|
||||
|
||||
setTimeout(executor(this), 0);*/
|
||||
core.Executor.instance.delay(this.updateNode, 0, this, [updateModel]);
|
||||
},
|
||||
|
||||
@@ -475,16 +464,6 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
model.setFontSize(value);
|
||||
}
|
||||
/*var elem = this;
|
||||
var executor = function(editor)
|
||||
{
|
||||
return function()
|
||||
{
|
||||
elem.updateNode(updateModel);
|
||||
};
|
||||
};
|
||||
|
||||
setTimeout(executor(this), 0);*/
|
||||
core.Executor.instance.delay(this.updateNode, 0, this, [updateModel]);
|
||||
|
||||
},
|
||||
@@ -496,16 +475,6 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
model.setFontStyle(value);
|
||||
}
|
||||
/*var elem = this;
|
||||
var executor = function(editor)
|
||||
{
|
||||
return function()
|
||||
{
|
||||
elem.updateNode(updateModel);
|
||||
};
|
||||
};
|
||||
|
||||
setTimeout(executor(this), 0);*/
|
||||
core.Executor.instance.delay(this.updateNode, 0, this, [updateModel]);
|
||||
},
|
||||
|
||||
@@ -870,9 +839,7 @@ mindplot.Topic = new Class({
|
||||
},
|
||||
|
||||
moveToBack : function() {
|
||||
// this._helpers.forEach(function(helper, index){
|
||||
// helper.moveToBack();
|
||||
// });
|
||||
|
||||
// Update relationship lines
|
||||
for (var j = 0; j < this._relationships.length; j++) {
|
||||
this._relationships[j].moveToBack();
|
||||
@@ -883,8 +850,6 @@ mindplot.Topic = new Class({
|
||||
}
|
||||
|
||||
this.get2DElement().moveToBack();
|
||||
|
||||
|
||||
},
|
||||
|
||||
moveToFront : function() {
|
||||
@@ -973,14 +938,6 @@ mindplot.Topic = new Class({
|
||||
type = 'mousedown';
|
||||
}
|
||||
|
||||
/* var textShape = this.getTextShape();
|
||||
textShape.addEventListener(type, listener);
|
||||
|
||||
var outerShape = this.getOuterShape();
|
||||
outerShape.addEventListener(type, listener);
|
||||
|
||||
var innerShape = this.getInnerShape();
|
||||
innerShape.addEventListener(type, listener);*/
|
||||
var shape = this.get2DElement();
|
||||
shape.addEventListener(type, listener);
|
||||
},
|
||||
@@ -990,15 +947,6 @@ mindplot.Topic = new Class({
|
||||
if (type == 'onfocus') {
|
||||
type = 'mousedown';
|
||||
}
|
||||
/*var textShape = this.getTextShape();
|
||||
textShape.removeEventListener(type, listener);
|
||||
|
||||
var outerShape = this.getOuterShape();
|
||||
outerShape.removeEventListener(type, listener);
|
||||
|
||||
var innerShape = this.getInnerShape();
|
||||
innerShape.removeEventListener(type, listener);*/
|
||||
|
||||
var shape = this.get2DElement();
|
||||
shape.removeEventListener(type, listener);
|
||||
},
|
||||
|
@@ -41,7 +41,7 @@ mindplot.commands.AddTopicCommand = new Class(
|
||||
var doneFn = function() {
|
||||
// Finally, focus ...
|
||||
var designer = commandContext._designer;
|
||||
designer.onObjectFocusEvent.attempt(topic, designer);
|
||||
designer.onObjectFocusEvent(topic);
|
||||
topic.setOnFocus(true);
|
||||
};
|
||||
|
||||
|
@@ -63,15 +63,19 @@ mindplot.layout.OriginalLayoutManager = new Class({
|
||||
nodesByOrder = null;
|
||||
return node.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE ? result : children;
|
||||
},
|
||||
|
||||
_nodeResizeEvent:function(node) {
|
||||
|
||||
},
|
||||
|
||||
_nodeRepositionateEvent:function(node) {
|
||||
this.getTopicBoardForTopic(node).repositionate();
|
||||
},
|
||||
|
||||
getDragTopicPositioner : function() {
|
||||
return this._dragTopicPositioner;
|
||||
},
|
||||
|
||||
_buildDragManager: function(workspace) {
|
||||
// Init dragger manager.
|
||||
var dragger = new mindplot.DragManager(workspace);
|
||||
@@ -116,11 +120,12 @@ mindplot.layout.OriginalLayoutManager = new Class({
|
||||
|
||||
return dragger;
|
||||
},
|
||||
|
||||
registerListenersOnNode : function(topic) {
|
||||
// Register node listeners ...
|
||||
var designer = this.getDesigner();
|
||||
topic.addEventListener('onfocus', function(event) {
|
||||
designer.onObjectFocusEvent.attempt([topic, event], designer);
|
||||
designer.onObjectFocusEvent(topic, event);
|
||||
});
|
||||
|
||||
// Add drag behaviour ...
|
||||
@@ -137,12 +142,15 @@ mindplot.layout.OriginalLayoutManager = new Class({
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
_createMainTopicBoard:function(node) {
|
||||
return new mindplot.MainTopicBoard(node, this);
|
||||
},
|
||||
|
||||
_createCentralTopicBoard:function(node) {
|
||||
return new mindplot.CentralTopicBoard(node, this);
|
||||
},
|
||||
|
||||
getClassName:function() {
|
||||
return mindplot.layout.OriginalLayoutManager.NAME;
|
||||
}
|
||||
|
Reference in New Issue
Block a user