Keep fixing issues.

This commit is contained in:
Paulo Gustavo Veiga 2014-03-04 22:59:39 -03:00
parent b46ad170fb
commit 3cf3b857a3
3 changed files with 70 additions and 70 deletions

View File

@ -24,11 +24,11 @@ mindplot.ScreenManager = new Class({
// Ignore default click event propagation. Prevent 'click' event on drag.
this._clickEvents = [];
this._divContainer.addEvent('click', function(event) {
this._divContainer.bind('click', function(event) {
event.stopPropagation()
}.bind(this));
this._divContainer.addEvent('dblclick', function(event) {
this._divContainer.bind('dblclick', function(event) {
event.stopPropagation();
event.preventDefault();
});
@ -43,7 +43,7 @@ mindplot.ScreenManager = new Class({
if (event == 'click')
this._clickEvents.push(listener);
else
this._divContainer.addEvent(event, listener);
this._divContainer.bind(event, listener);
},
removeEvent : function(event, listener) {
@ -62,7 +62,7 @@ mindplot.ScreenManager = new Class({
});
}
else {
this._divContainer.fireEvent(type, event);
this._divContainer.trigger(type, event);
}
},

View File

@ -26,8 +26,8 @@ mindplot.Workspace = new Class({
this._screenManager = screenManager;
var divContainer = screenManager.getContainer();
this._screenWidth = parseInt(divContainer.getStyle('width'));
this._screenHeight = parseInt(divContainer.getStyle('height'));
this._screenWidth = parseInt(divContainer.css('width'));
this._screenHeight = parseInt(divContainer.css('height'));
// Initialize web2d workspace.
var workspace = this._createWorkspace();

View File

@ -17,21 +17,21 @@
*/
mindplot.widget.Menu = new Class({
Extends:mindplot.widget.IMenu,
Extends: mindplot.widget.IMenu,
initialize:function (designer, containerId, mapId, readOnly, baseUrl) {
initialize: function (designer, containerId, mapId, readOnly, baseUrl) {
this.parent(designer, containerId, mapId);
baseUrl = !$defined(baseUrl) ? "" : baseUrl;
var widgetsBaseUrl = baseUrl + "css/widget";
// Stop event propagation ...
document.id(this._containerId).addEvent('click', function (event) {
$('#'+this._containerId).addEvent('click', function (event) {
event.stopPropagation();
return false;
});
document.id(this._containerId).addEvent('dblclick', function (event) {
$("#" + this._containerId).bind('dblclick', function (event) {
event.stopPropagation();
return false;
});
@ -39,10 +39,10 @@ mindplot.widget.Menu = new Class({
// Create panels ...
var designerModel = designer.getModel();
var fontFamilyBtn = document.id('fontFamily');
var fontFamilyBtn = $('#fontFamily');
if (fontFamilyBtn) {
var fontFamilyModel = {
getValue:function () {
getValue: function () {
var nodes = designerModel.filterSelectedTopics();
var result = null;
for (var i = 0; i < nodes.length; i++) {
@ -56,7 +56,7 @@ mindplot.widget.Menu = new Class({
return result;
},
setValue:function (value) {
setValue: function (value) {
designer.changeFontFamily(value);
}
@ -65,10 +65,10 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('fontFamily', $msg('FONT_FAMILY'));
}
var fontSizeBtn = document.id('fontSize');
var fontSizeBtn = $('#fontSize');
if (fontSizeBtn) {
var fontSizeModel = {
getValue:function () {
getValue: function () {
var nodes = designerModel.filterSelectedTopics();
var result = null;
for (var i = 0; i < nodes.length; i++) {
@ -81,7 +81,7 @@ mindplot.widget.Menu = new Class({
}
return result;
},
setValue:function (value) {
setValue: function (value) {
designer.changeFontSize(value);
}
};
@ -89,10 +89,10 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('fontSize', $msg('FONT_SIZE'));
}
var topicShapeBtn = document.id('topicShape');
var topicShapeBtn = $('#topicShape');
if (topicShapeBtn) {
var topicShapeModel = {
getValue:function () {
getValue: function () {
var nodes = designerModel.filterSelectedTopics();
var result = null;
for (var i = 0; i < nodes.length; i++) {
@ -105,7 +105,7 @@ mindplot.widget.Menu = new Class({
}
return result;
},
setValue:function (value) {
setValue: function (value) {
designer.changeTopicShape(value);
}
};
@ -113,14 +113,14 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('topicShape', $msg('TOPIC_SHAPE'));
}
var topicIconBtn = document.id('topicIcon');
var topicIconBtn = $('#topicIcon');
if (topicIconBtn) {
// Create icon panel dialog ...
var topicIconModel = {
getValue:function () {
getValue: function () {
return null;
},
setValue:function (value) {
setValue: function (value) {
designer.addIconType(value);
}
};
@ -129,11 +129,11 @@ mindplot.widget.Menu = new Class({
}
// Topic color item ...
var topicColorBtn = document.id('topicColor');
var topicColorBtn = $('#topicColor');
if (topicColorBtn) {
var topicColorModel = {
getValue:function () {
getValue: function () {
var nodes = designerModel.filterSelectedTopics();
var result = null;
for (var i = 0; i < nodes.length; i++) {
@ -146,7 +146,7 @@ mindplot.widget.Menu = new Class({
}
return result;
},
setValue:function (hex) {
setValue: function (hex) {
designer.changeBackgroundColor(hex);
}
};
@ -155,11 +155,11 @@ mindplot.widget.Menu = new Class({
}
// Border color item ...
var topicBorderBtn = document.id('topicBorder');
var topicBorderBtn = $('#topicBorder');
if (topicBorderBtn) {
var borderColorModel =
{
getValue:function () {
getValue: function () {
var nodes = designerModel.filterSelectedTopics();
var result = null;
for (var i = 0; i < nodes.length; i++) {
@ -172,7 +172,7 @@ mindplot.widget.Menu = new Class({
}
return result;
},
setValue:function (hex) {
setValue: function (hex) {
designer.changeBorderColor(hex);
}
};
@ -181,11 +181,11 @@ mindplot.widget.Menu = new Class({
}
// Font color item ...
var fontColorBtn = document.id('fontColor');
var fontColorBtn = $('#fontColor');
if (fontColorBtn) {
var fontColorModel =
{
getValue:function () {
getValue: function () {
var result = null;
var nodes = designerModel.filterSelectedTopics();
for (var i = 0; i < nodes.length; i++) {
@ -198,7 +198,7 @@ mindplot.widget.Menu = new Class({
}
return result;
},
setValue:function (hex) {
setValue: function (hex) {
designer.changeFontColor(hex);
}
};
@ -208,13 +208,13 @@ mindplot.widget.Menu = new Class({
this._addButton('export', false, false, function () {
var reqDialog = new MooDialog.Request('c/iframeWrapper.htm?url=c/maps/' + mapId + "/exportf", null,
{'class':'modalDialog exportModalDialog',
closeButton:true,
destroyOnClose:true,
title:$msg('EXPORT')
{'class': 'modalDialog exportModalDialog',
closeButton: true,
destroyOnClose: true,
title: $msg('EXPORT')
});
reqDialog.setRequestOptions({
onRequest:function () {
onRequest: function () {
reqDialog.setContent($msg('LOADING'));
}
});
@ -316,7 +316,7 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('fontItalic', $msg('FONT_ITALIC'), "meta+I");
var saveElem = document.id('save');
var saveElem = $('#save');
if (saveElem) {
this._addButton('save', false, false, function () {
this.save(saveElem, designer, true);
@ -327,7 +327,7 @@ mindplot.widget.Menu = new Class({
if (!readOnly) {
// To prevent the user from leaving the page with changes ...
Element.NativeEvents.unload = 1;
document.id(window).addEvent('unload', function () {
$(window).bind('unload', function () {
if (this.isSaveRequired()) {
this.save(saveElem, designer, false, true);
}
@ -343,7 +343,7 @@ mindplot.widget.Menu = new Class({
}
}
var discardElem = document.id('discard');
var discardElem = $('#discard');
if (discardElem) {
this._addButton('discard', false, false, function () {
this.discardChanges(designer);
@ -351,17 +351,17 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('discard', $msg('DISCARD_CHANGES'));
}
var shareElem = document.id('shareIt');
var shareElem = $('#shareIt');
if (shareElem) {
this._addButton('shareIt', false, false, function () {
var reqDialog = new MooDialog.Request('c/iframeWrapper?url=c/maps/' + mapId + "/sharef", null,
{'class':'modalDialog shareModalDialog',
closeButton:true,
destroyOnClose:true,
title:$msg('COLLABORATE')
{'class': 'modalDialog shareModalDialog',
closeButton: true,
destroyOnClose: true,
title: $msg('COLLABORATE')
});
reqDialog.setRequestOptions({
onRequest:function () {
onRequest: function () {
reqDialog.setContent($msg('LOADING'));
}
});
@ -371,17 +371,17 @@ mindplot.widget.Menu = new Class({
}
var publishElem = document.id('publishIt');
var publishElem = $('#publishIt');
if (publishElem) {
this._addButton('publishIt', false, false, function () {
var reqDialog = new MooDialog.Request('c/iframeWrapper?url=c/maps/' + mapId + "/publishf", null,
{'class':'modalDialog publishModalDialog',
closeButton:true,
destroyOnClose:true,
title:$msg('PUBLISH')
{'class': 'modalDialog publishModalDialog',
closeButton: true,
destroyOnClose: true,
title: $msg('PUBLISH')
});
reqDialog.setRequestOptions({
onRequest:function () {
onRequest: function () {
reqDialog.setContent($msg('LOADING'));
}
});
@ -391,18 +391,18 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('publishIt', $msg('PUBLISH'));
}
var historyElem = document.id('history');
var historyElem = $('#history');
if (historyElem) {
this._addButton('history', false, false, function () {
var reqDialog = new MooDialog.Request('c/iframeWrapper?url=c/maps/' + mapId + "/historyf", null,
{'class':'modalDialog historyModalDialog',
closeButton:true,
destroyOnClose:true,
title:$msg('HISTORY')
{'class': 'modalDialog historyModalDialog',
closeButton: true,
destroyOnClose: true,
title: $msg('HISTORY')
});
reqDialog.setRequestOptions({
onRequest:function () {
onRequest: function () {
reqDialog.setContent($msg('LOADING'));
}
});
@ -413,18 +413,18 @@ mindplot.widget.Menu = new Class({
this._registerEvents(designer);
// Keyboard Shortcuts Action ...
var keyboardShortcut = document.id('keyboardShortcuts');
var keyboardShortcut = $('#keyboardShortcuts');
if (keyboardShortcut) {
keyboardShortcut.addEvent('click', function (event) {
var reqDialog = new MooDialog.Request('c/keyboard', null,
{'class':'modalDialog keyboardModalDialog',
closeButton:true,
destroyOnClose:true,
title:$msg('SHORTCUTS')
{'class': 'modalDialog keyboardModalDialog',
closeButton: true,
destroyOnClose: true,
title: $msg('SHORTCUTS')
});
reqDialog.setRequestOptions({
onRequest:function () {
onRequest: function () {
reqDialog.setContent($msg('LOADING'));
}
});
@ -449,7 +449,7 @@ mindplot.widget.Menu = new Class({
},
_registerEvents:function (designer) {
_registerEvents: function (designer) {
// Register on close events ...
this._toolbarElems.each(function (elem) {
@ -498,15 +498,15 @@ mindplot.widget.Menu = new Class({
}.bind(this));
},
_addButton:function (buttonId, topic, rel, fn) {
_addButton: function (buttonId, topic, rel, fn) {
// Register Events ...
var result = null;
if (document.id(buttonId)) {
if ($('#'+buttonId)) {
var button = new mindplot.widget.ToolbarItem(buttonId, function (event) {
fn(event);
this.clear();
}.bind(this), {topicAction:topic, relAction:rel});
}.bind(this), {topicAction: topic, relAction: rel});
this._toolbarElems.push(button);
result = button;
@ -514,14 +514,14 @@ mindplot.widget.Menu = new Class({
return result;
},
_registerTooltip:function (buttonId, text, shortcut) {
if (document.id(buttonId)) {
_registerTooltip: function (buttonId, text, shortcut) {
if ($('#'+buttonId)) {
var tooltip = text;
if (shortcut) {
shortcut = Browser.Platform.mac ? shortcut.replace("meta+", "⌘") : shortcut.replace("meta+", "ctrl+");
tooltip = tooltip + " (" + shortcut + ")";
}
new mindplot.widget.KeyboardShortcutTooltip(document.id(buttonId), tooltip);
new mindplot.widget.KeyboardShortcutTooltip($('#'+buttonId), tooltip);
}
}
});