Keep fixing issues.

This commit is contained in:
Paulo Gustavo Veiga 2014-03-04 22:59:39 -03:00
parent f1fa99a85e
commit 695b8d92e3
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. // Ignore default click event propagation. Prevent 'click' event on drag.
this._clickEvents = []; this._clickEvents = [];
this._divContainer.addEvent('click', function(event) { this._divContainer.bind('click', function(event) {
event.stopPropagation() event.stopPropagation()
}.bind(this)); }.bind(this));
this._divContainer.addEvent('dblclick', function(event) { this._divContainer.bind('dblclick', function(event) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
}); });
@ -43,7 +43,7 @@ mindplot.ScreenManager = new Class({
if (event == 'click') if (event == 'click')
this._clickEvents.push(listener); this._clickEvents.push(listener);
else else
this._divContainer.addEvent(event, listener); this._divContainer.bind(event, listener);
}, },
removeEvent : function(event, listener) { removeEvent : function(event, listener) {
@ -62,7 +62,7 @@ mindplot.ScreenManager = new Class({
}); });
} }
else { else {
this._divContainer.fireEvent(type, event); this._divContainer.trigger(type, event);
} }
}, },

View File

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

View File

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