Working on the new editor ...

This commit is contained in:
Paulo Veiga
2011-10-10 18:30:02 -03:00
parent 2f9b53b045
commit cd85390b22
14 changed files with 622 additions and 949 deletions

View File

@@ -64,6 +64,10 @@ mindplot.DesignerKeyboard = new Class({
designer.createChildForSelectedNode();
}.bind(this),
'meta+enter' : function() {
designer.createChildForSelectedNode();
}.bind(this),
'ctrl+z' : function() {
designer.undo();
}.bind(this),

View File

@@ -68,7 +68,8 @@ mindplot.NoteIcon = new Class({
arrowOffset : 10,
center: true,
arrowSize: 15,
offset : {x:10,y:20}
offset : {x:10,y:20},
className:'notesTip'
});
},

View File

@@ -37,6 +37,7 @@ mindplot.widget.FloatingTip = new Class({
hideDelay: 250,
className: 'floating-tip',
offset: {x: 0, y: 0},
preventHideOnOver: true,
fx: { 'duration': 'short' }
},
@@ -75,9 +76,10 @@ mindplot.widget.FloatingTip = new Class({
return this;
element.store('floatingtip', tip);
this._animate(tip, 'in');
tip.addEvent(this.options.showOn, this.boundShow);
tip.addEvent(this.options.hideOn, this.boundHide);
if (this.options.preventHideOnOver) {
tip.addEvent(this.options.showOn, this.boundShow);
tip.addEvent(this.options.hideOn, this.boundHide);
}
this.fireEvent('show', [tip, element]);
return this;
},

View File

@@ -44,7 +44,11 @@ mindplot.widget.IconPanel = new Class({
id:iconId,
src:mindplot.ImageIcon.prototype._getImageUrl(iconId)
});
img.setStyles({width:16,height:16,padding:"0px 2px"}).inject(familyContent);
img.setStyles({width:16,
height:16,
padding:"0px 2px",
cursor: 'pointer'
}).inject(familyContent);
var panel = this;
var model = this.getModel();

View File

@@ -26,7 +26,6 @@ mindplot.widget.Menu = new Class({
this._designer = designer;
this._toolbarElems = [];
this._containerId = containerId;
this._toolbarDisabled = false;
// Stop event propagation ...
$(this._containerId).addEvent('click', function(event) {
@@ -181,15 +180,15 @@ mindplot.widget.Menu = new Class({
this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('fontColor', fontColorModel, baseUrl));
this.addButton('zoomIn', false, false, function() {
designer.zoomIn()
designer.zoomIn();
});
this.addButton('zoomOut', false, false, function() {
designer.zoomOut()
designer.zoomOut();
});
this.addButton('undoEdition', false, false, function() {
designer.undo()
designer.undo();
});
this.addButton('redoEdition', false, false, function() {
@@ -327,7 +326,10 @@ mindplot.widget.Menu = new Class({
if (button.isTopicAction() && button.isRelAction()) {
disable = rels.length == 0 && topics.length == 0;
} else if (button.isTopicAction() && topics.length == 0) {
} else if (!button.isTopicAction() && !button.isRelAction()) {
disable = false;
}
else if (button.isTopicAction() && topics.length == 0) {
disable = true;
} else if (button.isRelAction() && rels.length == 0) {
disable = true;
@@ -335,9 +337,10 @@ mindplot.widget.Menu = new Class({
if (disable) {
button.disable();
} else {
button.enable();
}
})
}.bind(this));
@@ -375,15 +378,15 @@ mindplot.widget.Menu = new Class({
addButton:function (buttonId, topic, rel, fn) {
// Register Events ...
var button = new mindplot.widget.ToolbarItem(buttonId, function(event) {
this.clear();
fn(event);
this.clear();
}.bind(this), {topicAction:topic,relAction:rel});
this._toolbarElems.push(button);
},
clear : function() {
this._toolbarElems.forEach(function(elem) {
elem.hide();
this._toolbarElems.forEach(function(item) {
item.hide();
});
}
});

View File

@@ -38,7 +38,7 @@ mindplot.widget.Monitor = new Class({
},
logMessage : function(msg, msgKind) {
console.log(userMsg);
console.log(msg);
}
});

View File

@@ -24,6 +24,28 @@ mindplot.widget.ToolbarItem = new Class({
this._buttonId = buttonId;
this._fn = fn;
this._options = options;
this.enable();
// this._tip = this._registerTip();
},
_registerTip: function() {
return new mindplot.widget.FloatingTip($(this._buttonId), {
html: false,
position: 'bottom',
arrowOffset : 5,
center: true,
arrowSize: 5,
showDelay: 500,
hideDelay: 0,
className: 'toolbarTip',
motionOnShow:false,
motionOnHide:false,
motion: 0,
distance: 0,
preventHideOnOver:false
});
},
getButtonElem : function() {
@@ -66,5 +88,9 @@ mindplot.widget.ToolbarItem = new Class({
elem.addClass('buttonOn');
this._enable = true;
}
}
},
getTip : function() {
return this._tip;
}.protect()
});

View File

@@ -38,6 +38,7 @@ mindplot.widget.ToolbarPaneItem = new Class({
_init:function () {
// Load the context of the panel ...
var panelElem = this.buildPanel();
panelElem.setStyle('cursor','default');
var buttonElem = this.getButtonElem();
// Add panel content ..
@@ -51,12 +52,6 @@ mindplot.widget.ToolbarPaneItem = new Class({
return this._model;
},
getButtonElem : function() {
var elem = $(this._buttonId);
$assert(elem, "Could not find element for " + this._buttonId);
return elem;
}.protect(),
getPanelElem : function() {
return $(this._panelId);
}.protect(),