mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-15 03:07:55 +01:00
Format some .js.
This commit is contained in:
parent
04e1f71faa
commit
3d36a4d9d4
@ -229,6 +229,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
|
||||
* connected, added to the drag manager, with events registered - complying type & read mode
|
||||
*/
|
||||
_buildNodeGraph: function (model, readOnly) {
|
||||
|
||||
// Create node graph ...
|
||||
var topic = mindplot.NodeGraph.create(model, {readOnly: readOnly});
|
||||
this.getModel().addTopic(topic);
|
||||
|
@ -211,5 +211,5 @@ mindplot.DragTopic.__getDragPivot = function () {
|
||||
mindplot.DragTopic._dragPivot = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -17,20 +17,20 @@
|
||||
*/
|
||||
|
||||
mindplot.EditorProperties = new Class({
|
||||
initialize:function() {
|
||||
initialize: function () {
|
||||
this._zoom = 0;
|
||||
this._position = 0;
|
||||
},
|
||||
|
||||
setZoom : function(zoom) {
|
||||
setZoom: function (zoom) {
|
||||
this._zoom = zoom;
|
||||
},
|
||||
|
||||
getZoom : function() {
|
||||
getZoom: function () {
|
||||
return this._zoom;
|
||||
},
|
||||
|
||||
asProperties : function() {
|
||||
asProperties: function () {
|
||||
return "zoom=" + this._zoom + "\n";
|
||||
}
|
||||
});
|
||||
|
@ -2,13 +2,13 @@ mindplot.Events = new Class({
|
||||
|
||||
$events: {},
|
||||
|
||||
_removeOn: function(string){
|
||||
return string.replace(/^on([A-Z])/, function(full, first){
|
||||
_removeOn: function (string) {
|
||||
return string.replace(/^on([A-Z])/, function (full, first) {
|
||||
return first.toLowerCase();
|
||||
});
|
||||
},
|
||||
|
||||
addEvent: function(type, fn, internal){
|
||||
addEvent: function (type, fn, internal) {
|
||||
type = this._removeOn(type);
|
||||
|
||||
this.$events[type] = (this.$events[type] || []).include(fn);
|
||||
@ -16,23 +16,23 @@ mindplot.Events = new Class({
|
||||
return this;
|
||||
},
|
||||
|
||||
fireEvent: function(type, args, delay){
|
||||
fireEvent: function (type, args, delay) {
|
||||
type = this._removeOn(type);
|
||||
var events = this.$events[type];
|
||||
if (!events) return this;
|
||||
args = Array.from(args);
|
||||
_.each(events, function(fn){
|
||||
_.each(events, function (fn) {
|
||||
if (delay) fn.delay(delay, this, args);
|
||||
else fn.apply(this, args);
|
||||
}, this);
|
||||
return this;
|
||||
},
|
||||
|
||||
removeEvent: function(type, fn){
|
||||
removeEvent: function (type, fn) {
|
||||
type = this._removeOn(type);
|
||||
var events = this.$events[type];
|
||||
if (events && !fn.internal){
|
||||
var index = events.indexOf(fn);
|
||||
if (events && !fn.internal) {
|
||||
var index = events.indexOf(fn);
|
||||
if (index != -1) events.splice(index, 1);
|
||||
}
|
||||
return this;
|
||||
|
@ -17,38 +17,38 @@
|
||||
*/
|
||||
|
||||
mindplot.Icon = new Class({
|
||||
initialize:function(url) {
|
||||
initialize: function (url) {
|
||||
$assert(url, 'topic can not be null');
|
||||
this._image = new web2d.Image();
|
||||
this._image.setHref(url);
|
||||
this._image.setSize(mindplot.Icon.SIZE, mindplot.Icon.SIZE);
|
||||
},
|
||||
|
||||
getImage : function() {
|
||||
getImage: function () {
|
||||
return this._image;
|
||||
},
|
||||
|
||||
setGroup : function(group) {
|
||||
setGroup: function (group) {
|
||||
this._group = group;
|
||||
},
|
||||
|
||||
getGroup : function() {
|
||||
getGroup: function () {
|
||||
return this._group;
|
||||
},
|
||||
|
||||
getSize : function() {
|
||||
getSize: function () {
|
||||
return this._image.getSize();
|
||||
},
|
||||
|
||||
getPosition : function() {
|
||||
getPosition: function () {
|
||||
return this._image.getPosition();
|
||||
},
|
||||
|
||||
addEvent : function(type, fnc) {
|
||||
addEvent: function (type, fnc) {
|
||||
this._image.addEvent(type, fnc);
|
||||
},
|
||||
|
||||
remove : function() {
|
||||
remove: function () {
|
||||
throw "Unsupported operation";
|
||||
}
|
||||
});
|
||||
|
@ -24,12 +24,19 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
|
||||
* @throws will throw an error if topicId is null or undefined
|
||||
* @throws will throw an error if iconSize is null or undefined
|
||||
*/
|
||||
initialize:function (topicId, iconSize) {
|
||||
initialize: function (topicId, iconSize) {
|
||||
$assert($defined(topicId), "topicId can not be null");
|
||||
$assert($defined(iconSize), "iconSize can not be null");
|
||||
|
||||
this._icons = [];
|
||||
this._group = new web2d.Group({width:0, height:iconSize, x:0, y:0, coordSizeWidth:0, coordSizeHeight:100});
|
||||
this._group = new web2d.Group({
|
||||
width: 0,
|
||||
height: iconSize,
|
||||
x: 0,
|
||||
y: 0,
|
||||
coordSizeWidth: 0,
|
||||
coordSizeHeight: 100
|
||||
});
|
||||
this._removeTip = new mindplot.IconGroup.RemoveTip(this._group, topicId);
|
||||
this.seIconSize(iconSize, iconSize);
|
||||
|
||||
@ -38,28 +45,28 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
|
||||
},
|
||||
|
||||
/** */
|
||||
setPosition:function (x, y) {
|
||||
setPosition: function (x, y) {
|
||||
this._group.setPosition(x, y);
|
||||
},
|
||||
|
||||
/** */
|
||||
getPosition:function () {
|
||||
getPosition: function () {
|
||||
return this._group.getPosition();
|
||||
},
|
||||
|
||||
/** */
|
||||
getNativeElement:function () {
|
||||
getNativeElement: function () {
|
||||
return this._group;
|
||||
},
|
||||
|
||||
/** */
|
||||
getSize:function () {
|
||||
getSize: function () {
|
||||
return this._group.getSize();
|
||||
},
|
||||
|
||||
/** */
|
||||
seIconSize:function (width, height) {
|
||||
this._iconSize = {width:width, height:height};
|
||||
seIconSize: function (width, height) {
|
||||
this._iconSize = {width: width, height: height};
|
||||
this._resize(this._icons.length);
|
||||
},
|
||||
|
||||
@ -68,7 +75,7 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
|
||||
* @param {Boolean} remove
|
||||
* @throws will throw an error if icon is not defined
|
||||
*/
|
||||
addIcon:function (icon, remove) {
|
||||
addIcon: function (icon, remove) {
|
||||
$defined(icon, "icon is not defined");
|
||||
|
||||
icon.setGroup(this);
|
||||
@ -87,7 +94,7 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
|
||||
}
|
||||
},
|
||||
|
||||
_findIconFromModel:function (iconModel) {
|
||||
_findIconFromModel: function (iconModel) {
|
||||
var result = null;
|
||||
_.each(this._icons, function (icon) {
|
||||
var elModel = icon.getModel();
|
||||
@ -104,14 +111,14 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
|
||||
},
|
||||
|
||||
/** */
|
||||
removeIconByModel:function (featureModel) {
|
||||
removeIconByModel: function (featureModel) {
|
||||
$assert(featureModel, "featureModel can not be null");
|
||||
|
||||
var icon = this._findIconFromModel(featureModel);
|
||||
this._removeIcon(icon);
|
||||
},
|
||||
|
||||
_removeIcon:function (icon) {
|
||||
_removeIcon: function (icon) {
|
||||
$assert(icon, "icon can not be null");
|
||||
|
||||
this._removeTip.close(0);
|
||||
@ -127,11 +134,11 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
|
||||
},
|
||||
|
||||
/** */
|
||||
moveToFront:function () {
|
||||
moveToFront: function () {
|
||||
this._group.moveToFront();
|
||||
},
|
||||
|
||||
_registerListeners:function () {
|
||||
_registerListeners: function () {
|
||||
this._group.addEvent('click', function (event) {
|
||||
// Avoid node creation ...
|
||||
event.stopPropagation();
|
||||
@ -144,14 +151,14 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
|
||||
});
|
||||
},
|
||||
|
||||
_resize:function (iconsLength) {
|
||||
_resize: function (iconsLength) {
|
||||
this._group.setSize(iconsLength * this._iconSize.width, this._iconSize.height);
|
||||
|
||||
var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2);
|
||||
this._group.setCoordSize(iconsLength * iconSize, iconSize);
|
||||
},
|
||||
|
||||
_positionIcon:function (icon, order) {
|
||||
_positionIcon: function (icon, order) {
|
||||
|
||||
var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2);
|
||||
icon.getImage().setPosition(iconSize * order + mindplot.IconGroup.ICON_PADDING, mindplot.IconGroup.ICON_PADDING);
|
||||
@ -171,7 +178,7 @@ mindplot.IconGroup.RemoveTip = new Class(/** @lends IconGroup.RemoveTip */{
|
||||
* @constructs
|
||||
* @param container
|
||||
*/
|
||||
initialize:function (container) {
|
||||
initialize: function (container) {
|
||||
$assert(container, "group can not be null");
|
||||
this._fadeElem = container;
|
||||
},
|
||||
@ -182,7 +189,7 @@ mindplot.IconGroup.RemoveTip = new Class(/** @lends IconGroup.RemoveTip */{
|
||||
* @param icon
|
||||
* @throws will throw an error if icon is null or undefined
|
||||
*/
|
||||
show:function (topicId, icon) {
|
||||
show: function (topicId, icon) {
|
||||
$assert(icon, 'icon can not be null');
|
||||
|
||||
// Nothing to do ...
|
||||
@ -224,14 +231,14 @@ mindplot.IconGroup.RemoveTip = new Class(/** @lends IconGroup.RemoveTip */{
|
||||
},
|
||||
|
||||
/** */
|
||||
hide:function () {
|
||||
hide: function () {
|
||||
this.close(200);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param delay
|
||||
*/
|
||||
close:function (delay) {
|
||||
close: function (delay) {
|
||||
|
||||
// This is not ok, trying to close the same dialog twice ?
|
||||
if (this._closeTimeoutId) {
|
||||
@ -257,43 +264,43 @@ mindplot.IconGroup.RemoveTip = new Class(/** @lends IconGroup.RemoveTip */{
|
||||
}
|
||||
},
|
||||
|
||||
_buildWeb2d:function () {
|
||||
_buildWeb2d: function () {
|
||||
var result = new web2d.Group({
|
||||
width:10,
|
||||
height:10,
|
||||
x:0,
|
||||
y:0,
|
||||
coordSizeWidth:10,
|
||||
coordSizeHeight:10
|
||||
width: 10,
|
||||
height: 10,
|
||||
x: 0,
|
||||
y: 0,
|
||||
coordSizeWidth: 10,
|
||||
coordSizeHeight: 10
|
||||
});
|
||||
|
||||
var outerRect = new web2d.Rect(0, {
|
||||
x:0,
|
||||
y:0,
|
||||
width:10,
|
||||
height:10,
|
||||
stroke:'0',
|
||||
fillColor:'black'
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 10,
|
||||
height: 10,
|
||||
stroke: '0',
|
||||
fillColor: 'black'
|
||||
});
|
||||
result.append(outerRect);
|
||||
outerRect.setCursor('pointer');
|
||||
|
||||
var innerRect = new web2d.Rect(0, {
|
||||
x:1,
|
||||
y:1,
|
||||
width:8,
|
||||
height:8,
|
||||
stroke:'1 solid white',
|
||||
fillColor:'gray'
|
||||
x: 1,
|
||||
y: 1,
|
||||
width: 8,
|
||||
height: 8,
|
||||
stroke: '1 solid white',
|
||||
fillColor: 'gray'
|
||||
});
|
||||
result.append(innerRect);
|
||||
|
||||
var line = new web2d.Line({stroke:'1 solid white'});
|
||||
var line = new web2d.Line({stroke: '1 solid white'});
|
||||
line.setFrom(1, 1);
|
||||
line.setTo(9, 9);
|
||||
result.append(line);
|
||||
|
||||
var line2 = new web2d.Line({stroke:'1 solid white'});
|
||||
var line2 = new web2d.Line({stroke: '1 solid white'});
|
||||
line2.setFrom(1, 9);
|
||||
line2.setTo(9, 1);
|
||||
result.append(line2);
|
||||
@ -314,7 +321,7 @@ mindplot.IconGroup.RemoveTip = new Class(/** @lends IconGroup.RemoveTip */{
|
||||
* @param topicId
|
||||
* @param icon
|
||||
*/
|
||||
decorate:function (topicId, icon) {
|
||||
decorate: function (topicId, icon) {
|
||||
|
||||
var me = this;
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
mindplot.ImageIcon = new Class({
|
||||
Extends:mindplot.Icon,
|
||||
initialize:function (topic, iconModel, readOnly) {
|
||||
Extends: mindplot.Icon,
|
||||
initialize: function (topic, iconModel, readOnly) {
|
||||
$assert(iconModel, 'iconModel can not be null');
|
||||
$assert(topic, 'topic can not be null');
|
||||
|
||||
@ -49,15 +49,15 @@ mindplot.ImageIcon = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_getImageUrl:function (iconId) {
|
||||
_getImageUrl: function (iconId) {
|
||||
return "icons/" + iconId + ".png";
|
||||
},
|
||||
|
||||
getModel:function () {
|
||||
getModel: function () {
|
||||
return this._featureModel;
|
||||
},
|
||||
|
||||
_getNextFamilyIconId:function (iconId) {
|
||||
_getNextFamilyIconId: function (iconId) {
|
||||
|
||||
var familyIcons = this._getFamilyIcons(iconId);
|
||||
$assert(familyIcons != null, "Family Icon not found!");
|
||||
@ -78,7 +78,7 @@ mindplot.ImageIcon = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
_getFamilyIcons:function (iconId) {
|
||||
_getFamilyIcons: function (iconId) {
|
||||
$assert(iconId != null, "id must not be null");
|
||||
$assert(iconId.indexOf("_") != -1, "Invalid icon id (it must contain '_')");
|
||||
|
||||
@ -95,7 +95,7 @@ mindplot.ImageIcon = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
remove:function () {
|
||||
remove: function () {
|
||||
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
||||
var featureId = this._featureModel.getId();
|
||||
var topicId = this._topicId;
|
||||
@ -104,30 +104,60 @@ mindplot.ImageIcon = new Class({
|
||||
});
|
||||
|
||||
mindplot.ImageIcon.prototype.ICON_FAMILIES = [
|
||||
{"id":"face", "icons":["face_plain", "face_sad", "face_crying", "face_smile", "face_surprise", "face_wink"]},
|
||||
{"id":"funy", "icons":["funy_angel", "funy_devilish", "funy_glasses", "funy_grin", "funy_kiss", "funy_monkey"]},
|
||||
{"id":"conn", "icons":["conn_connect", "conn_disconnect"]},
|
||||
{"id":"sport", "icons":["sport_basketball", "sport_football", "sport_golf", "sport_raquet", "sport_shuttlecock", "sport_soccer", "sport_tennis"]},
|
||||
{"id":"bulb", "icons":["bulb_light_on", "bulb_light_off"]},
|
||||
{"id":"thumb", "icons":["thumb_thumb_up", "thumb_thumb_down"]},
|
||||
{"id":"tick", "icons":["tick_tick", "tick_cross"]},
|
||||
{"id":"onoff", "icons":["onoff_clock", "onoff_clock_red", "onoff_add", "onoff_delete", "onoff_status_offline", "onoff_status_online"]},
|
||||
{"id":"money", "icons":["money_money", "money_dollar", "money_euro", "money_pound", "money_yen", "money_coins", "money_ruby"]},
|
||||
{"id":"time", "icons":["time_calendar", "time_clock", "time_hourglass"]},
|
||||
{"id":"number", "icons":["number_1", "number_2", "number_3", "number_4", "number_5", "number_6", "number_7", "number_8", "number_9"]},
|
||||
{"id":"chart", "icons":["chart_bar", "chart_line", "chart_curve", "chart_pie", "chart_organisation"]},
|
||||
{"id":"sign", "icons":["sign_warning", "sign_info", "sign_stop", "sign_help", "sign_cancel"]},
|
||||
{"id":"hard", "icons":["hard_cd", "hard_computer", "hard_controller", "hard_driver_disk", "hard_ipod", "hard_keyboard", "hard_mouse", "hard_printer"]},
|
||||
{"id":"soft", "icons":["soft_bug", "soft_cursor", "soft_database_table", "soft_database", "soft_feed", "soft_folder_explore", "soft_rss", "soft_penguin"]},
|
||||
{"id":"arrow", "icons":["arrow_up", "arrow_down", "arrow_left", "arrow_right"]},
|
||||
{"id":"arrowc", "icons":["arrowc_rotate_anticlockwise", "arrowc_rotate_clockwise", "arrowc_turn_left", "arrowc_turn_right"]},
|
||||
{"id":"people", "icons":["people_group", "people_male1", "people_male2", "people_female1", "people_female2"]},
|
||||
{"id":"mail", "icons":["mail_envelop", "mail_mailbox", "mail_edit", "mail_list"]},
|
||||
{"id":"flag", "icons":["flag_blue", "flag_green", "flag_orange", "flag_pink", "flag_purple", "flag_yellow"]},
|
||||
{"id":"bullet", "icons":["bullet_black", "bullet_blue", "bullet_green", "bullet_orange", "bullet_red", "bullet_pink", "bullet_purple"]},
|
||||
{"id":"tag", "icons":["tag_blue", "tag_green", "tag_orange", "tag_red", "tag_pink", "tag_yellow"]},
|
||||
{"id":"object", "icons":["object_bell", "object_clanbomber", "object_key", "object_pencil", "object_phone", "object_magnifier", "object_clip", "object_music", "object_star", "object_wizard", "object_house", "object_cake", "object_camera", "object_palette", "object_rainbow"]},
|
||||
{"id":"weather", "icons":["weather_clear-night", "weather_clear", "weather_few-clouds-night", "weather_few-clouds", "weather_overcast", "weather_severe-alert", "weather_showers-scattered", "weather_showers", "weather_snow", "weather_storm"]},
|
||||
{"id":"task", "icons":["task_0", "task_25", "task_50", "task_75", "task_100"]}
|
||||
{"id": "face", "icons": ["face_plain", "face_sad", "face_crying", "face_smile", "face_surprise", "face_wink"]},
|
||||
{"id": "funy", "icons": ["funy_angel", "funy_devilish", "funy_glasses", "funy_grin", "funy_kiss", "funy_monkey"]},
|
||||
{"id": "conn", "icons": ["conn_connect", "conn_disconnect"]},
|
||||
{
|
||||
"id": "sport",
|
||||
"icons": ["sport_basketball", "sport_football", "sport_golf", "sport_raquet", "sport_shuttlecock", "sport_soccer", "sport_tennis"]
|
||||
},
|
||||
{"id": "bulb", "icons": ["bulb_light_on", "bulb_light_off"]},
|
||||
{"id": "thumb", "icons": ["thumb_thumb_up", "thumb_thumb_down"]},
|
||||
{"id": "tick", "icons": ["tick_tick", "tick_cross"]},
|
||||
{
|
||||
"id": "onoff",
|
||||
"icons": ["onoff_clock", "onoff_clock_red", "onoff_add", "onoff_delete", "onoff_status_offline", "onoff_status_online"]
|
||||
},
|
||||
{
|
||||
"id": "money",
|
||||
"icons": ["money_money", "money_dollar", "money_euro", "money_pound", "money_yen", "money_coins", "money_ruby"]
|
||||
},
|
||||
{"id": "time", "icons": ["time_calendar", "time_clock", "time_hourglass"]},
|
||||
{
|
||||
"id": "number",
|
||||
"icons": ["number_1", "number_2", "number_3", "number_4", "number_5", "number_6", "number_7", "number_8", "number_9"]
|
||||
},
|
||||
{"id": "chart", "icons": ["chart_bar", "chart_line", "chart_curve", "chart_pie", "chart_organisation"]},
|
||||
{"id": "sign", "icons": ["sign_warning", "sign_info", "sign_stop", "sign_help", "sign_cancel"]},
|
||||
{
|
||||
"id": "hard",
|
||||
"icons": ["hard_cd", "hard_computer", "hard_controller", "hard_driver_disk", "hard_ipod", "hard_keyboard", "hard_mouse", "hard_printer"]
|
||||
},
|
||||
{
|
||||
"id": "soft",
|
||||
"icons": ["soft_bug", "soft_cursor", "soft_database_table", "soft_database", "soft_feed", "soft_folder_explore", "soft_rss", "soft_penguin"]
|
||||
},
|
||||
{"id": "arrow", "icons": ["arrow_up", "arrow_down", "arrow_left", "arrow_right"]},
|
||||
{
|
||||
"id": "arrowc",
|
||||
"icons": ["arrowc_rotate_anticlockwise", "arrowc_rotate_clockwise", "arrowc_turn_left", "arrowc_turn_right"]
|
||||
},
|
||||
{"id": "people", "icons": ["people_group", "people_male1", "people_male2", "people_female1", "people_female2"]},
|
||||
{"id": "mail", "icons": ["mail_envelop", "mail_mailbox", "mail_edit", "mail_list"]},
|
||||
{"id": "flag", "icons": ["flag_blue", "flag_green", "flag_orange", "flag_pink", "flag_purple", "flag_yellow"]},
|
||||
{
|
||||
"id": "bullet",
|
||||
"icons": ["bullet_black", "bullet_blue", "bullet_green", "bullet_orange", "bullet_red", "bullet_pink", "bullet_purple"]
|
||||
},
|
||||
{"id": "tag", "icons": ["tag_blue", "tag_green", "tag_orange", "tag_red", "tag_pink", "tag_yellow"]},
|
||||
{
|
||||
"id": "object",
|
||||
"icons": ["object_bell", "object_clanbomber", "object_key", "object_pencil", "object_phone", "object_magnifier", "object_clip", "object_music", "object_star", "object_wizard", "object_house", "object_cake", "object_camera", "object_palette", "object_rainbow"]
|
||||
},
|
||||
{
|
||||
"id": "weather",
|
||||
"icons": ["weather_clear-night", "weather_clear", "weather_few-clouds-night", "weather_few-clouds", "weather_overcast", "weather_severe-alert", "weather_showers-scattered", "weather_showers", "weather_snow", "weather_storm"]
|
||||
},
|
||||
{"id": "task", "icons": ["task_0", "task_25", "task_50", "task_75", "task_100"]}
|
||||
];
|
||||
|
||||
|
@ -18,14 +18,14 @@
|
||||
|
||||
mindplot.Keyboard = new Class({
|
||||
|
||||
initialize:function () {
|
||||
initialize: function () {
|
||||
},
|
||||
|
||||
addShortcut: function(shortcuts, callback) {
|
||||
addShortcut: function (shortcuts, callback) {
|
||||
if (!$.isArray(shortcuts)) {
|
||||
shortcuts = [shortcuts];
|
||||
}
|
||||
_.each(shortcuts, function(shortcut) {
|
||||
_.each(shortcuts, function (shortcut) {
|
||||
$(document).bind('keydown', shortcut, callback);
|
||||
});
|
||||
}
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
mindplot.LinkIcon = new Class({
|
||||
|
||||
Extends:mindplot.Icon,
|
||||
initialize:function (topic, linkModel, readOnly) {
|
||||
Extends: mindplot.Icon,
|
||||
initialize: function (topic, linkModel, readOnly) {
|
||||
$assert(topic, 'topic can not be null');
|
||||
$assert(linkModel, 'linkModel can not be null');
|
||||
|
||||
@ -31,7 +31,7 @@ mindplot.LinkIcon = new Class({
|
||||
this._registerEvents();
|
||||
},
|
||||
|
||||
_registerEvents:function () {
|
||||
_registerEvents: function () {
|
||||
this._image.setCursor('pointer');
|
||||
this._tip = new mindplot.widget.LinkIconTooltip(this);
|
||||
|
||||
@ -44,8 +44,8 @@ mindplot.LinkIcon = new Class({
|
||||
event.stopPropagation();
|
||||
});
|
||||
//FIXME: we shouldn't have timeout of that..
|
||||
this.addEvent("mouseleave", function(event) {
|
||||
window.setTimeout(function() {
|
||||
this.addEvent("mouseleave", function (event) {
|
||||
window.setTimeout(function () {
|
||||
if (!$("#linkPopover:hover").length) {
|
||||
me._tip.hide();
|
||||
}
|
||||
@ -54,12 +54,12 @@ mindplot.LinkIcon = new Class({
|
||||
});
|
||||
}
|
||||
|
||||
$(this.getImage()._peer._native).mouseenter(function() {
|
||||
$(this.getImage()._peer._native).mouseenter(function () {
|
||||
me._tip.show();
|
||||
})
|
||||
},
|
||||
|
||||
getModel:function () {
|
||||
getModel: function () {
|
||||
return this._linksModel;
|
||||
}
|
||||
});
|
||||
|
@ -17,31 +17,31 @@
|
||||
*/
|
||||
|
||||
mindplot.LocalStorageManager = new Class({
|
||||
Extends:mindplot.PersistenceManager,
|
||||
initialize:function (documentUrl,forceLoad) {
|
||||
Extends: mindplot.PersistenceManager,
|
||||
initialize: function (documentUrl, forceLoad) {
|
||||
this.parent();
|
||||
this.documentUrl = documentUrl;
|
||||
this.forceLoad = forceLoad;
|
||||
},
|
||||
|
||||
saveMapXml:function (mapId, mapXml, pref, saveHistory, events) {
|
||||
saveMapXml: function (mapId, mapXml, pref, saveHistory, events) {
|
||||
localStorage.setItem(mapId + "-xml", mapXml);
|
||||
},
|
||||
|
||||
discardChanges:function (mapId) {
|
||||
discardChanges: function (mapId) {
|
||||
localStorage.removeItem(mapId + "-xml");
|
||||
},
|
||||
|
||||
loadMapDom:function (mapId) {
|
||||
loadMapDom: function (mapId) {
|
||||
var xml = localStorage.getItem(mapId + "-xml");
|
||||
if (xml == null || this.forceLoad) {
|
||||
$.ajax({
|
||||
url: this.documentUrl.replace("{id}", mapId),
|
||||
headers:{"Content-Type":"text/plain","Accept":"application/xml"},
|
||||
type:'get',
|
||||
headers: {"Content-Type": "text/plain", "Accept": "application/xml"},
|
||||
type: 'get',
|
||||
dataType: "text",
|
||||
async: false,
|
||||
success:function (response) {
|
||||
success: function (response) {
|
||||
xml = response;
|
||||
}
|
||||
});
|
||||
@ -54,7 +54,7 @@ mindplot.LocalStorageManager = new Class({
|
||||
return jQuery.parseXML(xml);
|
||||
},
|
||||
|
||||
unlockMap:function (mindmap) {
|
||||
unlockMap: function (mindmap) {
|
||||
// Ignore, no implementation required ...
|
||||
}
|
||||
}
|
||||
|
@ -17,20 +17,20 @@
|
||||
*/
|
||||
|
||||
mindplot.MainTopic = new Class(/** @lends MainTopic */{
|
||||
Extends:mindplot.Topic,
|
||||
Extends: mindplot.Topic,
|
||||
/**
|
||||
* @extends mindplot.Topic
|
||||
* @constructs
|
||||
* @param model
|
||||
* @param options
|
||||
*/
|
||||
initialize:function (model, options) {
|
||||
initialize: function (model, options) {
|
||||
this.parent(model, options);
|
||||
},
|
||||
|
||||
INNER_RECT_ATTRIBUTES:{stroke:'0.5 solid #009900'},
|
||||
INNER_RECT_ATTRIBUTES: {stroke: '0.5 solid #009900'},
|
||||
|
||||
_buildDragShape:function () {
|
||||
_buildDragShape: function () {
|
||||
var innerShape = this._buildShape(this.INNER_RECT_ATTRIBUTES, this.getShapeType());
|
||||
var size = this.getSize();
|
||||
innerShape.setSize(size.width, size.height);
|
||||
@ -46,7 +46,7 @@ mindplot.MainTopic = new Class(/** @lends MainTopic */{
|
||||
innerShape.setAttribute("fillColor", bgColor);
|
||||
|
||||
// Create group ...
|
||||
var groupAttributes = {width:100, height:100, coordSizeWidth:100, coordSizeHeight:100};
|
||||
var groupAttributes = {width: 100, height: 100, coordSizeWidth: 100, coordSizeHeight: 100};
|
||||
var group = new web2d.Group(groupAttributes);
|
||||
group.append(innerShape);
|
||||
|
||||
@ -62,7 +62,7 @@ mindplot.MainTopic = new Class(/** @lends MainTopic */{
|
||||
},
|
||||
|
||||
/** */
|
||||
updateTopicShape:function (targetTopic, workspace) {
|
||||
updateTopicShape: function (targetTopic, workspace) {
|
||||
// Change figure based on the connected topic ...
|
||||
var model = this.getModel();
|
||||
var shapeType = model.getShapeType();
|
||||
@ -76,7 +76,7 @@ mindplot.MainTopic = new Class(/** @lends MainTopic */{
|
||||
},
|
||||
|
||||
/** */
|
||||
disconnect:function (workspace) {
|
||||
disconnect: function (workspace) {
|
||||
this.parent(workspace);
|
||||
var size = this.getSize();
|
||||
|
||||
@ -91,7 +91,7 @@ mindplot.MainTopic = new Class(/** @lends MainTopic */{
|
||||
innerShape.setVisibility(true);
|
||||
},
|
||||
|
||||
_updatePositionOnChangeSize:function (oldSize, newSize) {
|
||||
_updatePositionOnChangeSize: function (oldSize, newSize) {
|
||||
|
||||
var xOffset = Math.round((newSize.width - oldSize.width) / 2);
|
||||
var pos = this.getPosition();
|
||||
@ -106,12 +106,12 @@ mindplot.MainTopic = new Class(/** @lends MainTopic */{
|
||||
},
|
||||
|
||||
/** */
|
||||
workoutIncomingConnectionPoint:function (sourcePosition) {
|
||||
workoutIncomingConnectionPoint: function (sourcePosition) {
|
||||
return mindplot.util.Shape.workoutIncomingConnectionPoint(this, sourcePosition);
|
||||
},
|
||||
|
||||
/** */
|
||||
workoutOutgoingConnectionPoint:function (targetPosition) {
|
||||
workoutOutgoingConnectionPoint: function (targetPosition) {
|
||||
$assert(targetPosition, 'targetPoint can not be null');
|
||||
var pos = this.getPosition();
|
||||
var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, pos);
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
mindplot.Messages = new Class({
|
||||
Static:{
|
||||
init:function (locale) {
|
||||
Static: {
|
||||
init: function (locale) {
|
||||
locale = $defined(locale) ? locale : 'en';
|
||||
var bundle = mindplot.Messages.BUNDLES[locale];
|
||||
if (bundle == null && locale.indexOf("_") != -1) {
|
||||
|
@ -18,37 +18,37 @@
|
||||
|
||||
mindplot.MultilineTextEditor = new Class({
|
||||
Extends: mindplot.Events,
|
||||
initialize:function () {
|
||||
initialize: function () {
|
||||
this._topic = null;
|
||||
this._timeoutId = -1;
|
||||
},
|
||||
|
||||
_buildEditor:function () {
|
||||
_buildEditor: function () {
|
||||
|
||||
var result = $('<div></div>')
|
||||
.attr('id', 'textContainer')
|
||||
.css({
|
||||
display:"none",
|
||||
zIndex:"8",
|
||||
overflow:"hidden",
|
||||
border:"0 none"
|
||||
display: "none",
|
||||
zIndex: "8",
|
||||
overflow: "hidden",
|
||||
border: "0 none"
|
||||
});
|
||||
|
||||
|
||||
var textareaElem = $('<textarea tabindex="-1" value="" wrap="off" ></textarea>')
|
||||
.css({
|
||||
border:"1px gray dashed",
|
||||
background:"rgba(98, 135, 167, .3)",
|
||||
outline:'0 none',
|
||||
resize:'none',
|
||||
overflow:"hidden"
|
||||
border: "1px gray dashed",
|
||||
background: "rgba(98, 135, 167, .3)",
|
||||
outline: '0 none',
|
||||
resize: 'none',
|
||||
overflow: "hidden"
|
||||
});
|
||||
|
||||
result.append(textareaElem);
|
||||
return result;
|
||||
},
|
||||
|
||||
_registerEvents:function (containerElem) {
|
||||
_registerEvents: function (containerElem) {
|
||||
var textareaElem = this._getTextareaElem();
|
||||
var me = this;
|
||||
textareaElem.on('keydown', function (event) {
|
||||
@ -125,7 +125,7 @@ mindplot.MultilineTextEditor = new Class({
|
||||
});
|
||||
},
|
||||
|
||||
_adjustEditorSize:function () {
|
||||
_adjustEditorSize: function () {
|
||||
|
||||
if (this.isVisible()) {
|
||||
var textElem = this._getTextareaElem();
|
||||
@ -141,17 +141,17 @@ mindplot.MultilineTextEditor = new Class({
|
||||
textElem.attr('rows', lines.length);
|
||||
|
||||
this._containerElem.css({
|
||||
width:(maxLineLength + 3) + 'em',
|
||||
height:textElem.height()
|
||||
width: (maxLineLength + 3) + 'em',
|
||||
height: textElem.height()
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
isVisible:function () {
|
||||
isVisible: function () {
|
||||
return $defined(this._containerElem) && this._containerElem.css('display') == 'block';
|
||||
},
|
||||
|
||||
_updateModel:function () {
|
||||
_updateModel: function () {
|
||||
|
||||
if (this._topic.getText() != this._getText()) {
|
||||
var text = this._getText();
|
||||
@ -180,7 +180,7 @@ mindplot.MultilineTextEditor = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_showEditor:function (defaultText) {
|
||||
_showEditor: function (defaultText) {
|
||||
|
||||
var topic = this._topic;
|
||||
|
||||
@ -218,7 +218,7 @@ mindplot.MultilineTextEditor = new Class({
|
||||
this._timeoutId = displayFunc.delay(10);
|
||||
},
|
||||
|
||||
_setStyle:function (fontStyle) {
|
||||
_setStyle: function (fontStyle) {
|
||||
var inputField = this._getTextareaElem();
|
||||
if (!$defined(fontStyle.font)) {
|
||||
fontStyle.font = "Arial";
|
||||
@ -233,56 +233,56 @@ mindplot.MultilineTextEditor = new Class({
|
||||
fontStyle.size = 12;
|
||||
}
|
||||
var style = {
|
||||
fontSize:fontStyle.size + "px",
|
||||
fontFamily:fontStyle.font,
|
||||
fontStyle:fontStyle.style,
|
||||
fontWeight:fontStyle.weight,
|
||||
color:fontStyle.color
|
||||
fontSize: fontStyle.size + "px",
|
||||
fontFamily: fontStyle.font,
|
||||
fontStyle: fontStyle.style,
|
||||
fontWeight: fontStyle.weight,
|
||||
color: fontStyle.color
|
||||
};
|
||||
inputField.css(style);
|
||||
this._containerElem.css(style);
|
||||
},
|
||||
|
||||
_setText:function (text) {
|
||||
_setText: function (text) {
|
||||
var textareaElem = this._getTextareaElem();
|
||||
textareaElem.val(text);
|
||||
this._adjustEditorSize();
|
||||
},
|
||||
|
||||
_getText:function () {
|
||||
_getText: function () {
|
||||
return this._getTextareaElem().val();
|
||||
},
|
||||
|
||||
_getTextareaElem:function () {
|
||||
_getTextareaElem: function () {
|
||||
return this._containerElem.find('textarea');
|
||||
},
|
||||
|
||||
_positionCursor:function (textareaElem, selectText) {
|
||||
_positionCursor: function (textareaElem, selectText) {
|
||||
textareaElem.focus();
|
||||
var lenght = textareaElem.val().length;
|
||||
var lengh = textareaElem.val().length;
|
||||
if (selectText) {
|
||||
// Mark text as selected ...
|
||||
if (textareaElem.createTextRange) {
|
||||
var rang = textareaElem.createTextRange();
|
||||
rang.select();
|
||||
rang.move("character", lenght);
|
||||
rang.move("character", lengh);
|
||||
}
|
||||
else {
|
||||
textareaElem[0].setSelectionRange(0, lenght);
|
||||
textareaElem[0].setSelectionRange(0, lengh);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Move the cursor to the last character ..
|
||||
if (textareaElem.createTextRange) {
|
||||
var range = textareaElem.createTextRange();
|
||||
range.move("character", lenght);
|
||||
range.move("character", lengh);
|
||||
} else {
|
||||
if (Browser.ie11) {
|
||||
textareaElem[0].selectionStart = lenght;
|
||||
textareaElem[0].selectionEnd = lenght;
|
||||
textareaElem[0].selectionStart = lengh;
|
||||
textareaElem[0].selectionEnd = lengh;
|
||||
} else {
|
||||
textareaElem.selectionStart = lenght;
|
||||
textareaElem.selectionEnd = lenght;
|
||||
textareaElem.selectionStart = lengh;
|
||||
textareaElem.selectionEnd = lengh;
|
||||
}
|
||||
textareaElem.focus();
|
||||
}
|
||||
@ -290,7 +290,7 @@ mindplot.MultilineTextEditor = new Class({
|
||||
|
||||
},
|
||||
|
||||
close:function (update) {
|
||||
close: function (update) {
|
||||
if (this.isVisible() && this._topic) {
|
||||
// Update changes ...
|
||||
clearTimeout(this._timeoutId);
|
||||
|
@ -23,117 +23,117 @@ mindplot.NodeGraph = new Class(/** @lends NodeGraph */{
|
||||
* @param {Object<Number, String, Boolean>} options
|
||||
* @throws will throw an error if nodeModel is null or undefined
|
||||
*/
|
||||
initialize:function(nodeModel, options) {
|
||||
initialize: function (nodeModel, options) {
|
||||
$assert(nodeModel, "model can not be null");
|
||||
|
||||
this._options = options;
|
||||
this._mouseEvents = true;
|
||||
this.setModel(nodeModel);
|
||||
this._onFocus = false;
|
||||
this._size = {width:50,height:20};
|
||||
this._size = {width: 50, height: 20};
|
||||
},
|
||||
|
||||
/** @return true if option is set to read-only */
|
||||
isReadOnly : function(){
|
||||
isReadOnly: function () {
|
||||
return this._options.readOnly;
|
||||
},
|
||||
|
||||
/** @return model type */
|
||||
getType : function() {
|
||||
getType: function () {
|
||||
var model = this.getModel();
|
||||
return model.getType();
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {String} id
|
||||
* @throws will throw an error if the topic id is not a number
|
||||
*/
|
||||
setId : function(id) {
|
||||
setId: function (id) {
|
||||
$assert(typeof topic.getId() == "number", "id is not a number:" + id);
|
||||
this.getModel().setId(id);
|
||||
},
|
||||
|
||||
_set2DElement : function(elem2d) {
|
||||
_set2DElement: function (elem2d) {
|
||||
this._elem2d = elem2d;
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* @return 2D element
|
||||
* @throws will throw an error if the element is null or undefined within node graph
|
||||
*/
|
||||
get2DElement : function() {
|
||||
get2DElement: function () {
|
||||
$assert(this._elem2d, 'NodeGraph has not been initialized properly');
|
||||
return this._elem2d;
|
||||
},
|
||||
|
||||
/** @abstract */
|
||||
setPosition : function(point, fireEvent) {
|
||||
setPosition: function (point, fireEvent) {
|
||||
throw "Unsupported operation";
|
||||
},
|
||||
|
||||
/** */
|
||||
addEvent : function(type, listener) {
|
||||
addEvent: function (type, listener) {
|
||||
var elem = this.get2DElement();
|
||||
elem.addEvent(type, listener);
|
||||
},
|
||||
|
||||
/** */
|
||||
removeEvent : function(type, listener) {
|
||||
removeEvent: function (type, listener) {
|
||||
var elem = this.get2DElement();
|
||||
elem.removeEvent(type, listener);
|
||||
},
|
||||
|
||||
/** */
|
||||
fireEvent: function(type, event) {
|
||||
fireEvent: function (type, event) {
|
||||
var elem = this.get2DElement();
|
||||
elem.trigger(type, event);
|
||||
},
|
||||
|
||||
/** */
|
||||
setMouseEventsEnabled : function(isEnabled) {
|
||||
setMouseEventsEnabled: function (isEnabled) {
|
||||
this._mouseEvents = isEnabled;
|
||||
},
|
||||
|
||||
/** */
|
||||
isMouseEventsEnabled : function() {
|
||||
isMouseEventsEnabled: function () {
|
||||
return this._mouseEvents;
|
||||
},
|
||||
|
||||
/** @return {Object<Number>} size*/
|
||||
getSize : function() {
|
||||
getSize: function () {
|
||||
return this._size;
|
||||
},
|
||||
|
||||
/** @param {Object<Number>} size*/
|
||||
setSize : function(size) {
|
||||
setSize: function (size) {
|
||||
this._size.width = parseInt(size.width);
|
||||
this._size.height = parseInt(size.height);
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* @return {mindplot.model.NodeModel} the node model
|
||||
*/
|
||||
getModel:function() {
|
||||
getModel: function () {
|
||||
$assert(this._model, 'Model has not been initialized yet');
|
||||
return this._model;
|
||||
return this._model;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {mindplot.NodeModel} model the node model
|
||||
/**
|
||||
* @param {mindplot.NodeModel} model the node model
|
||||
* @throws will throw an error if model is null or undefined
|
||||
*/
|
||||
setModel : function(model) {
|
||||
setModel: function (model) {
|
||||
$assert(model, 'Model can not be null');
|
||||
this._model = model;
|
||||
},
|
||||
|
||||
/** */
|
||||
getId : function() {
|
||||
getId: function () {
|
||||
return this._model.getId();
|
||||
},
|
||||
|
||||
/** */
|
||||
setOnFocus : function(focus) {
|
||||
setOnFocus: function (focus) {
|
||||
if (this._onFocus != focus) {
|
||||
|
||||
this._onFocus = focus;
|
||||
@ -152,34 +152,34 @@ mindplot.NodeGraph = new Class(/** @lends NodeGraph */{
|
||||
this.closeEditors();
|
||||
|
||||
// Fire event ...
|
||||
this.fireEvent(focus ? 'ontfocus' : 'ontblur',this);
|
||||
this.fireEvent(focus ? 'ontfocus' : 'ontblur', this);
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/** @return {Boolean} true if the node graph is on focus */
|
||||
isOnFocus : function() {
|
||||
isOnFocus: function () {
|
||||
return this._onFocus;
|
||||
},
|
||||
|
||||
/** */
|
||||
dispose : function(workspace) {
|
||||
dispose: function (workspace) {
|
||||
this.setOnFocus(false);
|
||||
workspace.removeChild(this);
|
||||
},
|
||||
|
||||
/** */
|
||||
createDragNode : function(layoutManager) {
|
||||
createDragNode: function (layoutManager) {
|
||||
var dragShape = this._buildDragShape();
|
||||
return new mindplot.DragTopic(dragShape, this, layoutManager);
|
||||
return new mindplot.DragTopic(dragShape, this, layoutManager);
|
||||
},
|
||||
|
||||
_buildDragShape : function() {
|
||||
_buildDragShape: function () {
|
||||
$assert(false, '_buildDragShape must be implemented by all nodes.');
|
||||
},
|
||||
|
||||
/** */
|
||||
getPosition : function() {
|
||||
getPosition: function () {
|
||||
var model = this.getModel();
|
||||
return model.getPosition();
|
||||
}
|
||||
@ -192,11 +192,11 @@ mindplot.NodeGraph = new Class(/** @lends NodeGraph */{
|
||||
* @param {Object} options
|
||||
* @throws will throw an error if nodeModel is null or undefined
|
||||
* @throws will throw an error if the nodeModel's type is null or undefined
|
||||
* @throws will throw an error if the node type cannot be recognized as either central or main
|
||||
* @throws will throw an error if the node type cannot be recognized as either central or main
|
||||
* topic type
|
||||
* @return {mindplot.CentralTopic|mindplot.MainTopic} the new topic
|
||||
*/
|
||||
mindplot.NodeGraph.create = function(nodeModel, options) {
|
||||
mindplot.NodeGraph.create = function (nodeModel, options) {
|
||||
$assert(nodeModel, 'Model can not be null');
|
||||
|
||||
var type = nodeModel.getType();
|
||||
@ -205,8 +205,7 @@ mindplot.NodeGraph.create = function(nodeModel, options) {
|
||||
var result;
|
||||
if (type == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
result = new mindplot.CentralTopic(nodeModel, options);
|
||||
} else
|
||||
if (type == mindplot.model.INodeModel.MAIN_TOPIC_TYPE) {
|
||||
} else if (type == mindplot.model.INodeModel.MAIN_TOPIC_TYPE) {
|
||||
result = new mindplot.MainTopic(nodeModel, options);
|
||||
} else {
|
||||
$assert(false, "unsupported node type:" + type);
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
mindplot.NoteIcon = new Class({
|
||||
Extends:mindplot.Icon,
|
||||
initialize:function (topic, noteModel, readOnly) {
|
||||
Extends: mindplot.Icon,
|
||||
initialize: function (topic, noteModel, readOnly) {
|
||||
$assert(topic, 'topic can not be null');
|
||||
|
||||
this.parent(mindplot.NoteIcon.IMAGE_URL);
|
||||
@ -29,7 +29,7 @@ mindplot.NoteIcon = new Class({
|
||||
this._registerEvents();
|
||||
},
|
||||
|
||||
_registerEvents:function () {
|
||||
_registerEvents: function () {
|
||||
this._image.setCursor('pointer');
|
||||
var me = this;
|
||||
|
||||
@ -44,27 +44,27 @@ mindplot.NoteIcon = new Class({
|
||||
title: $msg('NOTE'),
|
||||
container: 'body',
|
||||
// Content can also be a function of the target element!
|
||||
content: function() {
|
||||
content: function () {
|
||||
return me._buildTooltipContent();
|
||||
},
|
||||
html:true,
|
||||
placement:'bottom',
|
||||
html: true,
|
||||
placement: 'bottom',
|
||||
destroyOnExit: true
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
_buildTooltipContent: function() {
|
||||
_buildTooltipContent: function () {
|
||||
if ($("body").find("#textPopoverNote").length == 1) {
|
||||
var text = $("body").find("#textPopoverNote");
|
||||
text.text(this._linksModel.getText());
|
||||
} else {
|
||||
var result = $('<div id="textPopoverNote"></div>').css({padding:'5px'});
|
||||
var result = $('<div id="textPopoverNote"></div>').css({padding: '5px'});
|
||||
|
||||
var text = $('<div></div>').text(this._linksModel.getText())
|
||||
.css({
|
||||
'white-space':'pre-wrap',
|
||||
'word-wrap':'break-word'
|
||||
'white-space': 'pre-wrap',
|
||||
'word-wrap': 'break-word'
|
||||
}
|
||||
);
|
||||
result.append(text);
|
||||
@ -72,7 +72,7 @@ mindplot.NoteIcon = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
getModel:function () {
|
||||
getModel: function () {
|
||||
return this._linksModel;
|
||||
}
|
||||
});
|
||||
|
@ -1,8 +1,8 @@
|
||||
Options = new Class({
|
||||
|
||||
setOptions: function(){
|
||||
setOptions: function () {
|
||||
var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments));
|
||||
if (this.addEvent) for (var option in options){
|
||||
if (this.addEvent) for (var option in options) {
|
||||
if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue;
|
||||
this.addEvent(option, options[option]);
|
||||
delete options[option];
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
mindplot.PersistenceManager = new Class({
|
||||
Static:{
|
||||
loadFromDom:function (mapId, mapDom) {
|
||||
Static: {
|
||||
loadFromDom: function (mapId, mapDom) {
|
||||
$assert(mapId, "mapId can not be null");
|
||||
$assert(mapDom, "mapDom can not be null");
|
||||
|
||||
@ -27,11 +27,11 @@ mindplot.PersistenceManager = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
initialize:function () {
|
||||
initialize: function () {
|
||||
|
||||
},
|
||||
|
||||
save:function (mindmap, editorProperties, saveHistory, events, sync) {
|
||||
save: function (mindmap, editorProperties, saveHistory, events, sync) {
|
||||
$assert(mindmap, "mindmap can not be null");
|
||||
$assert(editorProperties, "editorProperties can not be null");
|
||||
|
||||
@ -51,25 +51,25 @@ mindplot.PersistenceManager = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
load:function (mapId) {
|
||||
load: function (mapId) {
|
||||
$assert(mapId, "mapId can not be null");
|
||||
var domDocument = this.loadMapDom(mapId);
|
||||
return mindplot.PersistenceManager.loadFromDom(mapId, domDocument);
|
||||
return mindplot.PersistenceManager.loadFromDom(mapId, domDocument);
|
||||
},
|
||||
|
||||
discardChanges:function (mapId) {
|
||||
discardChanges: function (mapId) {
|
||||
throw new Error("Method must be implemented");
|
||||
},
|
||||
|
||||
loadMapDom:function (mapId) {
|
||||
loadMapDom: function (mapId) {
|
||||
throw new Error("Method must be implemented");
|
||||
},
|
||||
|
||||
saveMapXml:function (mapId, mapXml, pref, saveHistory, events, sync) {
|
||||
saveMapXml: function (mapId, mapXml, pref, saveHistory, events, sync) {
|
||||
throw new Error("Method must be implemented");
|
||||
},
|
||||
|
||||
unlockMap:function (mindmap) {
|
||||
unlockMap: function (mindmap) {
|
||||
throw new Error("Method must be implemented");
|
||||
}
|
||||
});
|
||||
|
@ -16,14 +16,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.Relationship = new Class({
|
||||
Extends:mindplot.ConnectionLine,
|
||||
Static:{
|
||||
getStrokeColor:function () {
|
||||
Extends: mindplot.ConnectionLine,
|
||||
Static: {
|
||||
getStrokeColor: function () {
|
||||
return '#9b74e6';
|
||||
},
|
||||
type:"Relationship"
|
||||
type: "Relationship"
|
||||
},
|
||||
initialize:function (sourceNode, targetNode, model) {
|
||||
initialize: function (sourceNode, targetNode, model) {
|
||||
$assert(sourceNode, "sourceNode can not be null");
|
||||
$assert(targetNode, "targetNode can not be null");
|
||||
|
||||
@ -71,12 +71,12 @@ mindplot.Relationship = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
setStroke:function (color, style, opacity) {
|
||||
setStroke: function (color, style, opacity) {
|
||||
this.parent(color, style, opacity);
|
||||
this._startArrow.setStrokeColor(color);
|
||||
},
|
||||
|
||||
redraw:function () {
|
||||
redraw: function () {
|
||||
var line2d = this._line2d;
|
||||
var sourceTopic = this._sourceTopic;
|
||||
var sourcePosition = sourceTopic.getPosition();
|
||||
@ -128,7 +128,7 @@ mindplot.Relationship = new Class({
|
||||
this._controlPointsController.redraw();
|
||||
},
|
||||
|
||||
_positionArrows:function () {
|
||||
_positionArrows: function () {
|
||||
var tpos = this._line2d.getTo();
|
||||
var spos = this._line2d.getFrom();
|
||||
|
||||
@ -159,7 +159,7 @@ mindplot.Relationship = new Class({
|
||||
this._startArrow.setVisibility(this.isVisible() && this._showStartArrow);
|
||||
},
|
||||
|
||||
addToWorkspace:function (workspace) {
|
||||
addToWorkspace: function (workspace) {
|
||||
workspace.append(this._focusShape);
|
||||
workspace.append(this._controlPointsController);
|
||||
|
||||
@ -177,11 +177,11 @@ mindplot.Relationship = new Class({
|
||||
|
||||
},
|
||||
|
||||
_initializeControlPointController:function () {
|
||||
_initializeControlPointController: function () {
|
||||
this.setOnFocus(true);
|
||||
},
|
||||
|
||||
removeFromWorkspace:function (workspace) {
|
||||
removeFromWorkspace: function (workspace) {
|
||||
workspace.removeChild(this._focusShape);
|
||||
workspace.removeChild(this._controlPointsController);
|
||||
this._line2d.removeEvent('click', this._controlPointControllerListener);
|
||||
@ -193,11 +193,11 @@ mindplot.Relationship = new Class({
|
||||
this.parent(workspace);
|
||||
},
|
||||
|
||||
getType:function () {
|
||||
getType: function () {
|
||||
return mindplot.Relationship.type;
|
||||
},
|
||||
|
||||
setOnFocus:function (focus) {
|
||||
setOnFocus: function (focus) {
|
||||
// Change focus shape
|
||||
if (this.isOnFocus() != focus) {
|
||||
if (focus) {
|
||||
@ -212,7 +212,7 @@ mindplot.Relationship = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_refreshShape:function () {
|
||||
_refreshShape: function () {
|
||||
var sPos = this._line2d.getFrom();
|
||||
var tPos = this._line2d.getTo();
|
||||
var ctrlPoints = this._line2d.getControlPoints();
|
||||
@ -226,7 +226,7 @@ mindplot.Relationship = new Class({
|
||||
this._focusShape.updateLine();
|
||||
},
|
||||
|
||||
addEvent:function (type, listener) {
|
||||
addEvent: function (type, listener) {
|
||||
// Translate to web 2d events ...
|
||||
if (type == 'onfocus') {
|
||||
type = 'mousedown';
|
||||
@ -236,22 +236,22 @@ mindplot.Relationship = new Class({
|
||||
line.addEvent(type, listener);
|
||||
},
|
||||
|
||||
isOnFocus:function () {
|
||||
isOnFocus: function () {
|
||||
return this._onFocus;
|
||||
},
|
||||
|
||||
isInWorkspace:function () {
|
||||
isInWorkspace: function () {
|
||||
return this._isInWorkspace;
|
||||
},
|
||||
|
||||
setVisibility:function (value) {
|
||||
setVisibility: function (value) {
|
||||
this.parent(value);
|
||||
if (this._showEndArrow)
|
||||
this._endArrow.setVisibility(this._showEndArrow);
|
||||
this._startArrow.setVisibility(this._showStartArrow && value);
|
||||
},
|
||||
|
||||
setOpacity:function (opacity) {
|
||||
setOpacity: function (opacity) {
|
||||
this.parent(opacity);
|
||||
if (this._showEndArrow)
|
||||
this._endArrow.setOpacity(opacity);
|
||||
@ -259,19 +259,19 @@ mindplot.Relationship = new Class({
|
||||
this._startArrow.setOpacity(opacity);
|
||||
},
|
||||
|
||||
setShowEndArrow:function (visible) {
|
||||
setShowEndArrow: function (visible) {
|
||||
this._showEndArrow = visible;
|
||||
if (this._isInWorkspace)
|
||||
this.redraw();
|
||||
},
|
||||
|
||||
setShowStartArrow:function (visible) {
|
||||
setShowStartArrow: function (visible) {
|
||||
this._showStartArrow = visible;
|
||||
if (this._isInWorkspace)
|
||||
this.redraw();
|
||||
},
|
||||
|
||||
setFrom:function (x, y) {
|
||||
setFrom: function (x, y) {
|
||||
$assert($defined(x), "x must be defined");
|
||||
$assert($defined(y), "y must be defined");
|
||||
|
||||
@ -279,7 +279,7 @@ mindplot.Relationship = new Class({
|
||||
this._startArrow.setFrom(x, y);
|
||||
},
|
||||
|
||||
setTo:function (x, y) {
|
||||
setTo: function (x, y) {
|
||||
$assert($defined(x), "x must be defined");
|
||||
$assert($defined(y), "y must be defined");
|
||||
|
||||
@ -288,42 +288,42 @@ mindplot.Relationship = new Class({
|
||||
this._endArrow.setFrom(x, y);
|
||||
},
|
||||
|
||||
setSrcControlPoint:function (control) {
|
||||
setSrcControlPoint: function (control) {
|
||||
this._line2d.setSrcControlPoint(control);
|
||||
this._startArrow.setControlPoint(control);
|
||||
},
|
||||
|
||||
setDestControlPoint:function (control) {
|
||||
setDestControlPoint: function (control) {
|
||||
this._line2d.setDestControlPoint(control);
|
||||
if (this._showEndArrow)
|
||||
this._endArrow.setControlPoint(control);
|
||||
},
|
||||
|
||||
getControlPoints:function () {
|
||||
getControlPoints: function () {
|
||||
return this._line2d.getControlPoints();
|
||||
},
|
||||
|
||||
isSrcControlPointCustom:function () {
|
||||
isSrcControlPointCustom: function () {
|
||||
return this._line2d.isSrcControlPointCustom();
|
||||
},
|
||||
|
||||
isDestControlPointCustom:function () {
|
||||
isDestControlPointCustom: function () {
|
||||
return this._line2d.isDestControlPointCustom();
|
||||
},
|
||||
|
||||
setIsSrcControlPointCustom:function (isCustom) {
|
||||
setIsSrcControlPointCustom: function (isCustom) {
|
||||
this._line2d.setIsSrcControlPointCustom(isCustom);
|
||||
},
|
||||
|
||||
setIsDestControlPointCustom:function (isCustom) {
|
||||
setIsDestControlPointCustom: function (isCustom) {
|
||||
this._line2d.setIsDestControlPointCustom(isCustom);
|
||||
},
|
||||
|
||||
getId:function () {
|
||||
getId: function () {
|
||||
return this._model.getId();
|
||||
},
|
||||
|
||||
fireEvent:function (type, event) {
|
||||
fireEvent: function (type, event) {
|
||||
var elem = this._line2d;
|
||||
elem.trigger(type, event);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
mindplot.RelationshipPivot = new Class({
|
||||
initialize:function (workspace, designer) {
|
||||
initialize: function (workspace, designer) {
|
||||
$assert(workspace, "workspace can not be null");
|
||||
$assert(designer, "designer can not be null");
|
||||
this._workspace = workspace;
|
||||
@ -30,7 +30,7 @@ mindplot.RelationshipPivot = new Class({
|
||||
|
||||
},
|
||||
|
||||
start:function (sourceTopic, targetPos) {
|
||||
start: function (sourceTopic, targetPos) {
|
||||
$assert(sourceTopic, "sourceTopic can not be null");
|
||||
$assert(targetPos, "targetPos can not be null");
|
||||
|
||||
@ -73,7 +73,7 @@ mindplot.RelationshipPivot = new Class({
|
||||
|
||||
},
|
||||
|
||||
dispose:function () {
|
||||
dispose: function () {
|
||||
var workspace = this._workspace;
|
||||
|
||||
if (this._isActive()) {
|
||||
@ -97,7 +97,7 @@ mindplot.RelationshipPivot = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_mouseMove:function (event) {
|
||||
_mouseMove: function (event) {
|
||||
var screen = this._workspace.getScreenManager();
|
||||
var pos = screen.getWorkspaceMousePosition(event);
|
||||
|
||||
@ -119,14 +119,14 @@ mindplot.RelationshipPivot = new Class({
|
||||
return false;
|
||||
},
|
||||
|
||||
_cleanOnMouseClick:function (event) {
|
||||
_cleanOnMouseClick: function (event) {
|
||||
|
||||
// The user clicks on a desktop on in other element that is not a node.
|
||||
this.dispose();
|
||||
event.stopPropagation();
|
||||
},
|
||||
|
||||
_calculateFromPosition:function (toPosition) {
|
||||
_calculateFromPosition: function (toPosition) {
|
||||
|
||||
// Calculate origin position ...
|
||||
var sourcePosition = this._sourceTopic.getPosition();
|
||||
@ -138,10 +138,10 @@ mindplot.RelationshipPivot = new Class({
|
||||
var spoint = new core.Point();
|
||||
spoint.x = parseInt(controlPoint[0].x) + parseInt(sourcePosition.x);
|
||||
spoint.y = parseInt(controlPoint[0].y) + parseInt(sourcePosition.y);
|
||||
return mindplot.util.Shape.calculateRelationShipPointCoordinates(this._sourceTopic, spoint);
|
||||
return mindplot.util.Shape.calculateRelationShipPointCoordinates(this._sourceTopic, spoint);
|
||||
},
|
||||
|
||||
_connectOnFocus:function (event, targetTopic) {
|
||||
_connectOnFocus: function (event, targetTopic) {
|
||||
var sourceTopic = this._sourceTopic;
|
||||
var mindmap = this._designer.getMindmap();
|
||||
|
||||
@ -153,7 +153,7 @@ mindplot.RelationshipPivot = new Class({
|
||||
this.dispose();
|
||||
},
|
||||
|
||||
_isActive:function () {
|
||||
_isActive: function () {
|
||||
return this._pivot != null;
|
||||
}
|
||||
});
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
mindplot.RESTPersistenceManager = new Class({
|
||||
Extends:mindplot.PersistenceManager,
|
||||
initialize:function (options) {
|
||||
Extends: mindplot.PersistenceManager,
|
||||
initialize: function (options) {
|
||||
this.parent();
|
||||
$assert(options.documentUrl, "documentUrl can not be null");
|
||||
$assert(options.revertUrl, "revertUrl can not be null");
|
||||
@ -33,12 +33,12 @@ mindplot.RESTPersistenceManager = new Class({
|
||||
this.session = options.session;
|
||||
},
|
||||
|
||||
saveMapXml:function (mapId, mapXml, pref, saveHistory, events, sync) {
|
||||
saveMapXml: function (mapId, mapXml, pref, saveHistory, events, sync) {
|
||||
|
||||
var data = {
|
||||
id:mapId,
|
||||
xml:mapXml,
|
||||
properties:pref
|
||||
id: mapId,
|
||||
xml: mapXml,
|
||||
properties: pref
|
||||
};
|
||||
|
||||
var persistence = this;
|
||||
@ -57,11 +57,11 @@ mindplot.RESTPersistenceManager = new Class({
|
||||
|
||||
$.ajax({
|
||||
url: this.documentUrl.replace("{id}", mapId) + "?" + query,
|
||||
type:'put',
|
||||
dataType:"json",
|
||||
type: 'put',
|
||||
dataType: "json",
|
||||
data: JSON.stringify(data),
|
||||
contentType:"application/json; charset=utf-8",
|
||||
async:!sync,
|
||||
contentType: "application/json; charset=utf-8",
|
||||
async: !sync,
|
||||
|
||||
success: function (data, textStatus, jqXHRresponseText) {
|
||||
persistence.timestamp = data;
|
||||
@ -77,10 +77,10 @@ mindplot.RESTPersistenceManager = new Class({
|
||||
}
|
||||
persistence.onSave = false;
|
||||
},
|
||||
fail:function (xhr, textStatus) {
|
||||
fail: function (xhr, textStatus) {
|
||||
|
||||
var responseText = xhr.responseText;
|
||||
var userMsg = {severity:"SEVERE", message:$msg('SAVE_COULD_NOT_BE_COMPLETED')};
|
||||
var userMsg = {severity: "SEVERE", message: $msg('SAVE_COULD_NOT_BE_COMPLETED')};
|
||||
|
||||
var contentType = xhr.getResponseHeader("Content-Type");
|
||||
if (contentType != null && contentType.indexOf("application/json") != -1) {
|
||||
@ -95,7 +95,7 @@ mindplot.RESTPersistenceManager = new Class({
|
||||
|
||||
} else {
|
||||
if (this.status == 405) {
|
||||
userMsg = {severity:"SEVERE", message:$msg('SESSION_EXPIRED')};
|
||||
userMsg = {severity: "SEVERE", message: $msg('SESSION_EXPIRED')};
|
||||
}
|
||||
}
|
||||
events.onError(userMsg);
|
||||
@ -105,27 +105,27 @@ mindplot.RESTPersistenceManager = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
discardChanges:function (mapId) {
|
||||
discardChanges: function (mapId) {
|
||||
$.ajax({
|
||||
url:this.revertUrl.replace("{id}", mapId),
|
||||
async:false,
|
||||
method:'post',
|
||||
headers:{"Content-Type":"application/json; charset=utf-8", "Accept":"application/json"}
|
||||
url: this.revertUrl.replace("{id}", mapId),
|
||||
async: false,
|
||||
method: 'post',
|
||||
headers: {"Content-Type": "application/json; charset=utf-8", "Accept": "application/json"}
|
||||
});
|
||||
},
|
||||
|
||||
unlockMap:function (mindmap) {
|
||||
unlockMap: function (mindmap) {
|
||||
var mapId = mindmap.getId();
|
||||
$.ajax({
|
||||
url:this.lockUrl.replace("{id}", mapId),
|
||||
async:false,
|
||||
method:'put',
|
||||
headers:{"Content-Type":"text/plain"},
|
||||
url: this.lockUrl.replace("{id}", mapId),
|
||||
async: false,
|
||||
method: 'put',
|
||||
headers: {"Content-Type": "text/plain"},
|
||||
data: "false"
|
||||
});
|
||||
},
|
||||
|
||||
_buildError:function (jsonSeverResponse) {
|
||||
_buildError: function (jsonSeverResponse) {
|
||||
var message = jsonSeverResponse ? jsonSeverResponse.globalErrors[0] : null;
|
||||
var severity = jsonSeverResponse ? jsonSeverResponse.globalSeverity : null;
|
||||
|
||||
@ -136,18 +136,18 @@ mindplot.RESTPersistenceManager = new Class({
|
||||
if (!severity) {
|
||||
severity = "INFO";
|
||||
}
|
||||
return {severity:severity, message:message};
|
||||
return {severity: severity, message: message};
|
||||
},
|
||||
|
||||
loadMapDom:function (mapId) {
|
||||
loadMapDom: function (mapId) {
|
||||
// Let's try to open one from the local directory ...
|
||||
var xml;
|
||||
$.ajax({
|
||||
url:this.documentUrl.replace("{id}", mapId) + "/xml",
|
||||
method:'get',
|
||||
async:false,
|
||||
headers:{"Content-Type":"text/plain","Accept":"application/xml"},
|
||||
success:function (responseText) {
|
||||
url: this.documentUrl.replace("{id}", mapId) + "/xml",
|
||||
method: 'get',
|
||||
async: false,
|
||||
headers: {"Content-Type": "text/plain", "Accept": "application/xml"},
|
||||
success: function (responseText) {
|
||||
xml = responseText;
|
||||
}
|
||||
});
|
||||
|
@ -17,47 +17,47 @@
|
||||
*/
|
||||
|
||||
mindplot.ScreenManager = new Class({
|
||||
initialize:function(divElement) {
|
||||
initialize: function (divElement) {
|
||||
$assert(divElement, "can not be null");
|
||||
this._divContainer = divElement;
|
||||
this._padding = {x:0,y:0};
|
||||
this._padding = {x: 0, y: 0};
|
||||
|
||||
// Ignore default click event propagation. Prevent 'click' event on drag.
|
||||
this._clickEvents = [];
|
||||
this._divContainer.bind('click', function(event) {
|
||||
this._divContainer.bind('click', function (event) {
|
||||
event.stopPropagation()
|
||||
});
|
||||
|
||||
this._divContainer.bind('dblclick', function(event) {
|
||||
this._divContainer.bind('dblclick', function (event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
});
|
||||
},
|
||||
|
||||
setScale : function(scale) {
|
||||
setScale: function (scale) {
|
||||
$assert(scale, 'Screen scale can not be null');
|
||||
this._scale = scale;
|
||||
},
|
||||
|
||||
addEvent : function(event, listener) {
|
||||
addEvent: function (event, listener) {
|
||||
if (event == 'click')
|
||||
this._clickEvents.push(listener);
|
||||
else
|
||||
this._divContainer.bind(event, listener);
|
||||
this._divContainer.bind(event, listener);
|
||||
},
|
||||
|
||||
removeEvent : function(event, listener) {
|
||||
removeEvent: function (event, listener) {
|
||||
if (event == 'click') {
|
||||
this._clickEvents.remove(listener);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this._divContainer.unbind(event, listener);
|
||||
}
|
||||
},
|
||||
|
||||
fireEvent : function(type, event) {
|
||||
fireEvent: function (type, event) {
|
||||
if (type == 'click') {
|
||||
_.each(this._clickEvents, function(listener) {
|
||||
_.each(this._clickEvents, function (listener) {
|
||||
listener(type, event);
|
||||
});
|
||||
}
|
||||
@ -66,7 +66,7 @@ mindplot.ScreenManager = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_getElementPosition : function(elem) {
|
||||
_getElementPosition: function (elem) {
|
||||
// Retrieve current element position.
|
||||
var elementPosition = elem.getPosition();
|
||||
var x = elementPosition.x;
|
||||
@ -81,10 +81,10 @@ mindplot.ScreenManager = new Class({
|
||||
y = y / this._scale;
|
||||
|
||||
// Remove decimal part..
|
||||
return {x:x,y:y};
|
||||
return {x: x, y: y};
|
||||
},
|
||||
|
||||
getWorkspaceIconPosition : function(e) {
|
||||
getWorkspaceIconPosition: function (e) {
|
||||
// Retrieve current icon position.
|
||||
var image = e.getImage();
|
||||
var elementPosition = image.getPosition();
|
||||
@ -97,7 +97,7 @@ mindplot.ScreenManager = new Class({
|
||||
var groupSize = group.getSize();
|
||||
var coordSize = group.getCoordSize();
|
||||
|
||||
var scale = {x:coordSize.width / parseInt(groupSize.width), y:coordSize.height / parseInt(groupSize.height)};
|
||||
var scale = {x: coordSize.width / parseInt(groupSize.width), y: coordSize.height / parseInt(groupSize.height)};
|
||||
|
||||
var x = (elementPosition.x - coordOrigin.x - (parseInt(imageSize.width) / 2)) / scale.x;
|
||||
var y = (elementPosition.y - coordOrigin.y - (parseInt(imageSize.height) / 2)) / scale.y;
|
||||
@ -113,18 +113,18 @@ mindplot.ScreenManager = new Class({
|
||||
topicPosition.x = topicPosition.x - (parseInt(topic.getSize().width) / 2);
|
||||
|
||||
// Remove decimal part..
|
||||
return {x:x + topicPosition.x,y:y + topicPosition.y};
|
||||
return {x: x + topicPosition.x, y: y + topicPosition.y};
|
||||
},
|
||||
|
||||
getWorkspaceMousePosition : function(event) {
|
||||
getWorkspaceMousePosition: function (event) {
|
||||
// Retrieve current mouse position.
|
||||
var x = event.clientX;
|
||||
var y = event.clientY;
|
||||
|
||||
//FIXME: paulo: why? Subtract div position.
|
||||
/*var containerPosition = this.getContainer().position();
|
||||
x = x - containerPosition.x;
|
||||
y = y - containerPosition.y;*/
|
||||
x = x - containerPosition.x;
|
||||
y = y - containerPosition.y;*/
|
||||
|
||||
// Scale coordinate in order to be relative to the workspace. That's coordSize/size;
|
||||
x = x * this._scale;
|
||||
@ -138,11 +138,11 @@ mindplot.ScreenManager = new Class({
|
||||
return new core.Point(x, y);
|
||||
},
|
||||
|
||||
getContainer : function() {
|
||||
getContainer: function () {
|
||||
return this._divContainer;
|
||||
},
|
||||
|
||||
setOffset : function(x, y) {
|
||||
setOffset: function (x, y) {
|
||||
this._padding.x = x;
|
||||
this._padding.y = y;
|
||||
}
|
||||
|
@ -17,14 +17,14 @@
|
||||
*/
|
||||
|
||||
mindplot.ShirinkConnector = new Class({
|
||||
initialize: function(topic) {
|
||||
initialize: function (topic) {
|
||||
|
||||
var ellipse = new web2d.Elipse(mindplot.Topic.prototype.INNER_RECT_ATTRIBUTES);
|
||||
this._ellipse = ellipse;
|
||||
ellipse.setFill('rgb(62,118,179)');
|
||||
|
||||
ellipse.setSize(mindplot.Topic.CONNECTOR_WIDTH, mindplot.Topic.CONNECTOR_WIDTH);
|
||||
ellipse.addEvent('click', function(event) {
|
||||
ellipse.addEvent('click', function (event) {
|
||||
var model = topic.getModel();
|
||||
var collapse = !model.areChildrenShrunken();
|
||||
|
||||
@ -36,22 +36,22 @@ mindplot.ShirinkConnector = new Class({
|
||||
|
||||
});
|
||||
|
||||
ellipse.addEvent('mousedown', function(event) {
|
||||
ellipse.addEvent('mousedown', function (event) {
|
||||
// Avoid node creation ...
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
ellipse.addEvent('dblclick', function(event) {
|
||||
ellipse.addEvent('dblclick', function (event) {
|
||||
// Avoid node creation ...
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
ellipse.addEvent('mouseover', function(event) {
|
||||
ellipse.addEvent('mouseover', function (event) {
|
||||
|
||||
ellipse.setFill('rgb(153, 0, 255)');
|
||||
});
|
||||
var me = this;
|
||||
ellipse.addEvent('mouseout', function(event) {
|
||||
ellipse.addEvent('mouseout', function (event) {
|
||||
var color = topic.getBackgroundColor();
|
||||
me.setFill(color);
|
||||
});
|
||||
@ -63,7 +63,7 @@ mindplot.ShirinkConnector = new Class({
|
||||
|
||||
},
|
||||
|
||||
changeRender: function(isShrink) {
|
||||
changeRender: function (isShrink) {
|
||||
var elipse = this._ellipse;
|
||||
if (isShrink) {
|
||||
elipse.setStroke('2', 'solid');
|
||||
@ -72,36 +72,36 @@ mindplot.ShirinkConnector = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
setVisibility: function(value) {
|
||||
setVisibility: function (value) {
|
||||
this._ellipse.setVisibility(value);
|
||||
},
|
||||
|
||||
setOpacity: function(opacity) {
|
||||
setOpacity: function (opacity) {
|
||||
this._ellipse.setOpacity(opacity);
|
||||
},
|
||||
|
||||
setFill: function(color) {
|
||||
setFill: function (color) {
|
||||
this._fillColor = color;
|
||||
this._ellipse.setFill(color);
|
||||
},
|
||||
|
||||
setAttribute: function(name, value) {
|
||||
setAttribute: function (name, value) {
|
||||
this._ellipse.setAttribute(name, value);
|
||||
},
|
||||
|
||||
addToWorkspace: function(group) {
|
||||
addToWorkspace: function (group) {
|
||||
group.append(this._ellipse);
|
||||
},
|
||||
|
||||
setPosition: function(x, y) {
|
||||
setPosition: function (x, y) {
|
||||
this._ellipse.setPosition(x, y);
|
||||
},
|
||||
|
||||
moveToBack: function() {
|
||||
moveToBack: function () {
|
||||
this._ellipse.moveToBack();
|
||||
},
|
||||
|
||||
moveToFront: function() {
|
||||
moveToFront: function () {
|
||||
this._ellipse.moveToFront();
|
||||
}
|
||||
});
|
||||
|
@ -18,38 +18,41 @@
|
||||
|
||||
//FIXME: Not used!
|
||||
mindplot.TextEditor = new Class({
|
||||
initialize:function(topic) {
|
||||
initialize: function (topic) {
|
||||
this._topic = topic;
|
||||
},
|
||||
|
||||
_buildEditor : function() {
|
||||
_buildEditor: function () {
|
||||
|
||||
this._size = {width:500, height:100};
|
||||
this._size = {width: 500, height: 100};
|
||||
var result = new Element('div');
|
||||
result.setStyles({
|
||||
position:"absolute",
|
||||
position: "absolute",
|
||||
display: "none",
|
||||
zIndex: "8",
|
||||
width:"500px",
|
||||
height:"100px"}
|
||||
width: "500px",
|
||||
height: "100px"
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
var inputContainer = new Element('div');
|
||||
inputContainer.setStyles({
|
||||
border:"none",
|
||||
overflow:"auto"
|
||||
border: "none",
|
||||
overflow: "auto"
|
||||
});
|
||||
inputContainer.inject(result);
|
||||
|
||||
var inputText = new Element('input',
|
||||
{type:"text",
|
||||
tabindex:'-1',
|
||||
value:""}
|
||||
{
|
||||
type: "text",
|
||||
tabindex: '-1',
|
||||
value: ""
|
||||
}
|
||||
);
|
||||
inputText.setStyles({
|
||||
border:"none",
|
||||
background:"transparent"
|
||||
border: "none",
|
||||
background: "transparent"
|
||||
});
|
||||
inputText.inject(inputContainer);
|
||||
|
||||
@ -57,7 +60,7 @@ mindplot.TextEditor = new Class({
|
||||
spanContainer.setStyle('visibility', "hidden");
|
||||
spanContainer.inject(result);
|
||||
|
||||
var spanElem = new Element('span', {tabindex:"-1"});
|
||||
var spanElem = new Element('span', {tabindex: "-1"});
|
||||
spanElem.setStyle('white-space', "nowrap");
|
||||
spanElem.setStyle('nowrap', 'nowrap');
|
||||
spanElem.inject(spanContainer);
|
||||
@ -66,7 +69,7 @@ mindplot.TextEditor = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
_registerEvents : function(divElem) {
|
||||
_registerEvents: function (divElem) {
|
||||
var inputElem = this._getTextareaElem();
|
||||
var spanElem = this._getSpanElem();
|
||||
var me = this;
|
||||
@ -92,22 +95,22 @@ mindplot.TextEditor = new Class({
|
||||
});
|
||||
|
||||
// If the user clicks on the input, all event must be ignored ...
|
||||
divElem.addEvent('click', function(event) {
|
||||
divElem.addEvent('click', function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
divElem.addEvent('dblclick', function(event) {
|
||||
divElem.addEvent('dblclick', function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
divElem.addEvent('mousedown', function(event) {
|
||||
divElem.addEvent('mousedown', function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
},
|
||||
|
||||
isVisible : function () {
|
||||
isVisible: function () {
|
||||
return $defined(this._containerElem) && this._containerElem.getStyle('display') == 'block';
|
||||
},
|
||||
|
||||
_updateModel : function () {
|
||||
_updateModel: function () {
|
||||
|
||||
if (this._topic.getText() != this._getText()) {
|
||||
var text = this._getText();
|
||||
@ -118,7 +121,7 @@ mindplot.TextEditor = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
show : function (text) {
|
||||
show: function (text) {
|
||||
|
||||
if (!this.isVisible()) {
|
||||
//Create editor ui
|
||||
@ -131,7 +134,7 @@ mindplot.TextEditor = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_showEditor : function (defaultText) {
|
||||
_showEditor: function (defaultText) {
|
||||
|
||||
var topic = this._topic;
|
||||
|
||||
@ -151,7 +154,7 @@ mindplot.TextEditor = new Class({
|
||||
|
||||
var me = this;
|
||||
// Set editor's initial size
|
||||
var displayFunc = function() {
|
||||
var displayFunc = function () {
|
||||
// Position the editor and set the size...
|
||||
var textShape = me._topic.getTextShape();
|
||||
|
||||
@ -171,7 +174,7 @@ mindplot.TextEditor = new Class({
|
||||
displayFunc.delay(10);
|
||||
},
|
||||
|
||||
_setStyle : function (fontStyle) {
|
||||
_setStyle: function (fontStyle) {
|
||||
var inputField = this._getTextareaElem();
|
||||
var spanField = this._getSpanElem();
|
||||
if (!$defined(fontStyle.font)) {
|
||||
@ -197,7 +200,7 @@ mindplot.TextEditor = new Class({
|
||||
spanField.style.fontSize = fontStyle.size + "px";
|
||||
},
|
||||
|
||||
_setText : function(text) {
|
||||
_setText: function (text) {
|
||||
var inputField = this._getTextareaElem();
|
||||
inputField.size = text.length + 1;
|
||||
this._containerElem.style.width = (inputField.size * parseInt(inputField.style.fontSize) + 100) + "px";
|
||||
@ -206,27 +209,27 @@ mindplot.TextEditor = new Class({
|
||||
inputField.value = text;
|
||||
},
|
||||
|
||||
_getText : function() {
|
||||
_getText: function () {
|
||||
return this._getTextareaElem().value;
|
||||
},
|
||||
|
||||
_getTextareaElem : function() {
|
||||
_getTextareaElem: function () {
|
||||
return this._containerElem.getElement('input');
|
||||
},
|
||||
|
||||
_getSpanElem : function() {
|
||||
_getSpanElem: function () {
|
||||
return this._containerElem.getElement('span');
|
||||
},
|
||||
|
||||
_setEditorSize : function (width, height) {
|
||||
_setEditorSize: function (width, height) {
|
||||
var textShape = this._topic.getTextShape();
|
||||
var scale = web2d.peer.utils.TransformUtil.workoutScale(textShape._peer);
|
||||
this._size = {width:width * scale.width, height:height * scale.height};
|
||||
this._size = {width: width * scale.width, height: height * scale.height};
|
||||
this._containerElem.style.width = this._size.width * 2 + "px";
|
||||
this._containerElem.style.height = this._size.height + "px";
|
||||
},
|
||||
|
||||
_positionCursor : function(inputElem, selectText) {
|
||||
_positionCursor: function (inputElem, selectText) {
|
||||
// Select text if it's required ...
|
||||
if (inputElem.createTextRange) //ie
|
||||
{
|
||||
@ -246,7 +249,7 @@ mindplot.TextEditor = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
close : function(update) {
|
||||
close: function (update) {
|
||||
if (this.isVisible()) {
|
||||
// Update changes ...
|
||||
if (!$defined(update) || update) {
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
mindplot.TextEditorFactory = {};
|
||||
|
||||
mindplot.TextEditorFactory.getTextEditorFromName = function(name) {
|
||||
mindplot.TextEditorFactory.getTextEditorFromName = function (name) {
|
||||
var editorClass = null;
|
||||
if (name == "RichTextEditor") {
|
||||
editorClass = mindplot.RichTextEditor;
|
||||
|
@ -21,33 +21,33 @@ mindplot.TopicEventDispatcher = new Class({
|
||||
Static: {
|
||||
_instance: null,
|
||||
|
||||
configure: function(readOnly) {
|
||||
configure: function (readOnly) {
|
||||
this._instance = new mindplot.TopicEventDispatcher(readOnly);
|
||||
},
|
||||
|
||||
getInstance : function() {
|
||||
getInstance: function () {
|
||||
return this._instance;
|
||||
}
|
||||
},
|
||||
|
||||
initialize:function(readOnly) {
|
||||
initialize: function (readOnly) {
|
||||
this._readOnly = readOnly;
|
||||
this._activeEditor = null;
|
||||
this._multilineEditor = new mindplot.MultilineTextEditor();
|
||||
},
|
||||
|
||||
close : function(update) {
|
||||
close: function (update) {
|
||||
if (this.isVisible()) {
|
||||
this._activeEditor.close(update);
|
||||
this._activeEditor = null;
|
||||
}
|
||||
},
|
||||
|
||||
show : function(topic, options) {
|
||||
show: function (topic, options) {
|
||||
this.process(mindplot.TopicEvent.EDIT, topic, options);
|
||||
},
|
||||
|
||||
process : function(eventType, topic, options) {
|
||||
process: function (eventType, topic, options) {
|
||||
$assert(eventType, "eventType can not be null");
|
||||
|
||||
// Close all previous open editor ....
|
||||
@ -61,18 +61,18 @@ mindplot.TopicEventDispatcher = new Class({
|
||||
this._multilineEditor.show(topic, options ? options.text : null);
|
||||
this._activeEditor = this._multilineEditor;
|
||||
} else {
|
||||
this.fireEvent(eventType, {model:model,readOnly:this._readOnly});
|
||||
this.fireEvent(eventType, {model: model, readOnly: this._readOnly});
|
||||
}
|
||||
},
|
||||
|
||||
isVisible: function() {
|
||||
isVisible: function () {
|
||||
return this._activeEditor != null && this._activeEditor.isVisible();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mindplot.TopicEvent = {
|
||||
EDIT : "editnode",
|
||||
CLICK : "clicknode"
|
||||
EDIT: "editnode",
|
||||
CLICK: "clicknode"
|
||||
};
|
||||
|
||||
|
@ -19,31 +19,31 @@
|
||||
/** */
|
||||
mindplot.TopicFeature = {
|
||||
/** the icon object */
|
||||
Icon:{
|
||||
id:mindplot.model.IconModel.FEATURE_TYPE,
|
||||
model:mindplot.model.IconModel,
|
||||
icon:mindplot.ImageIcon
|
||||
Icon: {
|
||||
id: mindplot.model.IconModel.FEATURE_TYPE,
|
||||
model: mindplot.model.IconModel,
|
||||
icon: mindplot.ImageIcon
|
||||
},
|
||||
|
||||
/** the link object */
|
||||
Link:{
|
||||
id:mindplot.model.LinkModel.FEATURE_TYPE,
|
||||
model:mindplot.model.LinkModel,
|
||||
icon:mindplot.LinkIcon
|
||||
Link: {
|
||||
id: mindplot.model.LinkModel.FEATURE_TYPE,
|
||||
model: mindplot.model.LinkModel,
|
||||
icon: mindplot.LinkIcon
|
||||
},
|
||||
|
||||
/** the note object */
|
||||
Note:{
|
||||
id:mindplot.model.NoteModel.FEATURE_TYPE,
|
||||
model:mindplot.model.NoteModel,
|
||||
icon:mindplot.NoteIcon
|
||||
Note: {
|
||||
id: mindplot.model.NoteModel.FEATURE_TYPE,
|
||||
model: mindplot.model.NoteModel,
|
||||
icon: mindplot.NoteIcon
|
||||
},
|
||||
|
||||
/**
|
||||
* @param id the feature metadata id
|
||||
* @return {Boolean} returns true if the given id is contained in the metadata array
|
||||
*/
|
||||
isSupported:function (id) {
|
||||
isSupported: function (id) {
|
||||
return mindplot.TopicFeature._featuresMetadataById.some(function (elem) {
|
||||
return elem.id == id;
|
||||
});
|
||||
@ -54,10 +54,10 @@ mindplot.TopicFeature = {
|
||||
* @param attributes
|
||||
* @throws will throw an error if type is null or undefined
|
||||
* @throws will throw an error if attributes is null or undefined
|
||||
* @return {mindplot.model.FeatureModel} a new instance of the feature model subclass matching
|
||||
* @return {mindplot.model.FeatureModel} a new instance of the feature model subclass matching
|
||||
* the topic feature
|
||||
*/
|
||||
createModel:function (type, attributes) {
|
||||
createModel: function (type, attributes) {
|
||||
$assert(type, 'type can not be null');
|
||||
$assert(attributes, 'attributes can not be null');
|
||||
|
||||
@ -75,7 +75,7 @@ mindplot.TopicFeature = {
|
||||
* @throws will throw an error if model is null or undefined
|
||||
* @return {mindplot.Icon} a new instance of the icon subclass matching the topic feature
|
||||
*/
|
||||
createIcon:function (topic, model, readOnly) {
|
||||
createIcon: function (topic, model, readOnly) {
|
||||
$assert(topic, 'topic can not be null');
|
||||
$assert(model, 'model can not be null');
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.TopicStyle = new Class({
|
||||
Static:{
|
||||
_getStyles:function (topic) {
|
||||
Static: {
|
||||
_getStyles: function (topic) {
|
||||
$assert(topic, "topic can not be null");
|
||||
|
||||
var result;
|
||||
@ -38,28 +38,28 @@ mindplot.TopicStyle = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
defaultText:function (topic) {
|
||||
defaultText: function (topic) {
|
||||
var msgKey = this._getStyles(topic).msgKey;
|
||||
return $msg(msgKey);
|
||||
return $msg(msgKey);
|
||||
},
|
||||
|
||||
defaultFontStyle:function (topic) {
|
||||
defaultFontStyle: function (topic) {
|
||||
return this._getStyles(topic).fontStyle;
|
||||
},
|
||||
|
||||
defaultBackgroundColor:function (topic) {
|
||||
defaultBackgroundColor: function (topic) {
|
||||
return this._getStyles(topic).backgroundColor;
|
||||
},
|
||||
|
||||
defaultBorderColor:function (topic) {
|
||||
defaultBorderColor: function (topic) {
|
||||
return this._getStyles(topic).borderColor;
|
||||
},
|
||||
|
||||
getInnerPadding:function (topic) {
|
||||
getInnerPadding: function (topic) {
|
||||
return this._getStyles(topic).innerPadding;
|
||||
},
|
||||
|
||||
defaultShapeType:function (topic) {
|
||||
defaultShapeType: function (topic) {
|
||||
return this._getStyles(topic).shapeType;
|
||||
}
|
||||
|
||||
@ -68,65 +68,65 @@ mindplot.TopicStyle = new Class({
|
||||
|
||||
mindplot.TopicStyle.STYLES =
|
||||
{
|
||||
CENTRAL_TOPIC:{
|
||||
borderColor:'rgb(57,113,177)',
|
||||
backgroundColor:'rgb(80,157,192)',
|
||||
fontStyle:{
|
||||
font:"Verdana",
|
||||
size:10,
|
||||
style:"normal",
|
||||
weight:"bold",
|
||||
color:"#ffffff"
|
||||
CENTRAL_TOPIC: {
|
||||
borderColor: 'rgb(57,113,177)',
|
||||
backgroundColor: 'rgb(80,157,192)',
|
||||
fontStyle: {
|
||||
font: "Verdana",
|
||||
size: 10,
|
||||
style: "normal",
|
||||
weight: "bold",
|
||||
color: "#ffffff"
|
||||
},
|
||||
msgKey:'CENTRAL_TOPIC',
|
||||
innerPadding:11,
|
||||
shapeType:mindplot.model.TopicShape.ROUNDED_RECT
|
||||
msgKey: 'CENTRAL_TOPIC',
|
||||
innerPadding: 11,
|
||||
shapeType: mindplot.model.TopicShape.ROUNDED_RECT
|
||||
},
|
||||
|
||||
MAIN_TOPIC:{
|
||||
borderColor:'rgb(2,59,185)',
|
||||
backgroundColor:'rgb(224,229,239)',
|
||||
fontStyle:{
|
||||
font:"Arial",
|
||||
size:8,
|
||||
style:"normal",
|
||||
weight:"normal",
|
||||
color:"rgb(82,92,97)"
|
||||
MAIN_TOPIC: {
|
||||
borderColor: 'rgb(2,59,185)',
|
||||
backgroundColor: 'rgb(224,229,239)',
|
||||
fontStyle: {
|
||||
font: "Arial",
|
||||
size: 8,
|
||||
style: "normal",
|
||||
weight: "normal",
|
||||
color: "rgb(82,92,97)"
|
||||
},
|
||||
msgKey:'MAIN_TOPIC',
|
||||
innerPadding:3,
|
||||
shapeType:mindplot.model.TopicShape.LINE
|
||||
msgKey: 'MAIN_TOPIC',
|
||||
innerPadding: 3,
|
||||
shapeType: mindplot.model.TopicShape.LINE
|
||||
|
||||
},
|
||||
|
||||
SUB_TOPIC:{
|
||||
borderColor:'rgb(2,59,185)',
|
||||
backgroundColor:'rgb(224,229,239)',
|
||||
fontStyle:{
|
||||
font:"Arial",
|
||||
size:6,
|
||||
style:"normal",
|
||||
weight:"normal",
|
||||
color:"rgb(82,92,97)"
|
||||
SUB_TOPIC: {
|
||||
borderColor: 'rgb(2,59,185)',
|
||||
backgroundColor: 'rgb(224,229,239)',
|
||||
fontStyle: {
|
||||
font: "Arial",
|
||||
size: 6,
|
||||
style: "normal",
|
||||
weight: "normal",
|
||||
color: "rgb(82,92,97)"
|
||||
},
|
||||
msgKey:'SUB_TOPIC',
|
||||
innerPadding:3,
|
||||
shapeType:mindplot.model.TopicShape.LINE
|
||||
msgKey: 'SUB_TOPIC',
|
||||
innerPadding: 3,
|
||||
shapeType: mindplot.model.TopicShape.LINE
|
||||
},
|
||||
|
||||
ISOLATED_TOPIC:{
|
||||
borderColor:'rgb(2,59,185)',
|
||||
backgroundColor:'rgb(224,229,239)',
|
||||
fontStyle:{
|
||||
font:"Verdana",
|
||||
size:8,
|
||||
style:"normal",
|
||||
weight:"normal",
|
||||
color:"rgb(82,92,97)"
|
||||
ISOLATED_TOPIC: {
|
||||
borderColor: 'rgb(2,59,185)',
|
||||
backgroundColor: 'rgb(224,229,239)',
|
||||
fontStyle: {
|
||||
font: "Verdana",
|
||||
size: 8,
|
||||
style: "normal",
|
||||
weight: "normal",
|
||||
color: "rgb(82,92,97)"
|
||||
},
|
||||
msgKey:'ISOLATED_TOPIC',
|
||||
innerPadding:4,
|
||||
shapeType:mindplot.model.TopicShape.LINE
|
||||
msgKey: 'ISOLATED_TOPIC',
|
||||
innerPadding: 4,
|
||||
shapeType: mindplot.model.TopicShape.LINE
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
mindplot.Workspace = new Class({
|
||||
initialize: function(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');
|
||||
@ -42,7 +42,7 @@ mindplot.Workspace = new Class({
|
||||
this._eventsEnabled = true;
|
||||
},
|
||||
|
||||
_createWorkspace: function() {
|
||||
_createWorkspace: function () {
|
||||
// Initialize workspace ...
|
||||
var coordOriginX = -(this._screenWidth / 2);
|
||||
var coordOriginY = -(this._screenHeight / 2);
|
||||
@ -50,18 +50,18 @@ mindplot.Workspace = new Class({
|
||||
var workspaceProfile = {
|
||||
width: this._screenWidth + "px",
|
||||
height: this._screenHeight + "px",
|
||||
coordSizeWidth:this._screenWidth,
|
||||
coordSizeHeight:this._screenHeight,
|
||||
coordOriginX:coordOriginX,
|
||||
coordOriginY:coordOriginY,
|
||||
fillColor:'transparent',
|
||||
strokeWidth:0
|
||||
coordSizeWidth: this._screenWidth,
|
||||
coordSizeHeight: this._screenHeight,
|
||||
coordOriginX: coordOriginX,
|
||||
coordOriginY: coordOriginY,
|
||||
fillColor: 'transparent',
|
||||
strokeWidth: 0
|
||||
};
|
||||
web2d.peer.Toolkit.init();
|
||||
return new web2d.Workspace(workspaceProfile);
|
||||
return new web2d.Workspace(workspaceProfile);
|
||||
},
|
||||
|
||||
append: function(shape) {
|
||||
append: function (shape) {
|
||||
if ($defined(shape.addToWorkspace)) {
|
||||
shape.addToWorkspace(this);
|
||||
} else {
|
||||
@ -69,7 +69,7 @@ mindplot.Workspace = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
removeChild: function(shape) {
|
||||
removeChild: function (shape) {
|
||||
// Element is a node, not a web2d element?
|
||||
if ($defined(shape.removeFromWorkspace)) {
|
||||
shape.removeFromWorkspace(this);
|
||||
@ -78,21 +78,21 @@ mindplot.Workspace = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
addEvent: function(type, listener) {
|
||||
addEvent: function (type, listener) {
|
||||
this._workspace.addEvent(type, listener);
|
||||
},
|
||||
|
||||
removeEvent: function(type, listener) {
|
||||
removeEvent: function (type, listener) {
|
||||
$assert(type, 'type can not be null');
|
||||
$assert(listener, 'listener can not be null');
|
||||
this._workspace.removeEvent(type, listener);
|
||||
},
|
||||
|
||||
getSize: function() {
|
||||
getSize: function () {
|
||||
return this._workspace.getCoordSize();
|
||||
},
|
||||
|
||||
setZoom: function(zoom, center) {
|
||||
setZoom: function (zoom, center) {
|
||||
this._zoom = zoom;
|
||||
var workspace = this._workspace;
|
||||
|
||||
@ -135,27 +135,27 @@ mindplot.Workspace = new Class({
|
||||
this._screenManager.fireEvent('update');
|
||||
},
|
||||
|
||||
getScreenManager: function() {
|
||||
getScreenManager: function () {
|
||||
return this._screenManager;
|
||||
},
|
||||
|
||||
enableWorkspaceEvents: function(value) {
|
||||
enableWorkspaceEvents: function (value) {
|
||||
this._eventsEnabled = value;
|
||||
},
|
||||
|
||||
isWorkspaceEventsEnabled: function() {
|
||||
isWorkspaceEventsEnabled: function () {
|
||||
return this._eventsEnabled;
|
||||
},
|
||||
|
||||
dumpNativeChart: function() {
|
||||
dumpNativeChart: function () {
|
||||
return this._workspace.dumpNativeChart();
|
||||
},
|
||||
|
||||
_registerDragEvents: function() {
|
||||
_registerDragEvents: function () {
|
||||
var workspace = this._workspace;
|
||||
var screenManager = this._screenManager;
|
||||
var mWorkspace = this;
|
||||
var mouseDownListener = function(event) {
|
||||
var mouseDownListener = function (event) {
|
||||
if (!$defined(workspace._mouseMoveListener)) {
|
||||
if (mWorkspace.isWorkspaceEventsEnabled()) {
|
||||
mWorkspace.enableWorkspaceEvents(false);
|
||||
@ -164,7 +164,7 @@ mindplot.Workspace = new Class({
|
||||
var originalCoordOrigin = workspace.getCoordOrigin();
|
||||
|
||||
var wasDragged = false;
|
||||
workspace._mouseMoveListener = function(event) {
|
||||
workspace._mouseMoveListener = function (event) {
|
||||
|
||||
var currentMousePosition = screenManager.getWorkspaceMousePosition(event);
|
||||
|
||||
@ -193,7 +193,7 @@ mindplot.Workspace = new Class({
|
||||
screenManager.addEvent('mousemove', workspace._mouseMoveListener);
|
||||
|
||||
// Register mouse up listeners ...
|
||||
workspace._mouseUpListener = function(event) {
|
||||
workspace._mouseUpListener = function (event) {
|
||||
|
||||
screenManager.removeEvent('mousemove', workspace._mouseMoveListener);
|
||||
screenManager.removeEvent('mouseup', workspace._mouseUpListener);
|
||||
@ -219,7 +219,7 @@ mindplot.Workspace = new Class({
|
||||
screenManager.addEvent('mousedown', mouseDownListener);
|
||||
},
|
||||
|
||||
setViewPort : function(size) {
|
||||
setViewPort: function (size) {
|
||||
this._viewPort = size;
|
||||
}
|
||||
});
|
||||
|
@ -30,7 +30,7 @@ mindplot.persistence = {};
|
||||
|
||||
mindplot.layout = {};
|
||||
|
||||
Class.Mutators.Static = function(items){
|
||||
Class.Mutators.Static = function (items) {
|
||||
this.extend(items);
|
||||
};
|
||||
|
||||
|
@ -17,27 +17,36 @@
|
||||
*/
|
||||
|
||||
core.Point = new Class({
|
||||
initialize : function(x, y) {
|
||||
/**
|
||||
* @constructs
|
||||
* @param {Number} x coordinate
|
||||
* @param {Number} y coordinate
|
||||
*/
|
||||
initialize: function (x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
},
|
||||
|
||||
setValue : function(x, y) {
|
||||
/**
|
||||
* @param {Number} x coordinate
|
||||
* @param {Number} y coordinate
|
||||
*/
|
||||
setValue: function (x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
},
|
||||
|
||||
inspect : function() {
|
||||
inspect: function () {
|
||||
return "{x:" + this.x + ",y:" + this.y + "}";
|
||||
},
|
||||
|
||||
clone : function() {
|
||||
clone: function () {
|
||||
return new core.Point(this.x, this.y);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
core.Point.fromString = function(point) {
|
||||
core.Point.fromString = function (point) {
|
||||
var values = point.split(',');
|
||||
return new core.Point(values[0], values[1]);
|
||||
|
||||
|
@ -22,8 +22,10 @@ web2d.Workspace = new Class({
|
||||
this._htmlContainer = this._createDivContainer();
|
||||
|
||||
var peer = web2d.peer.Toolkit.createWorkspace(this._htmlContainer);
|
||||
var defaultAttributes = {width: '200px', height: '200px', stroke: '1px solid #edf1be',
|
||||
fillColor: "white", coordOrigin: '0 0', coordSize: '200 200' };
|
||||
var defaultAttributes = {
|
||||
width: '200px', height: '200px', stroke: '1px solid #edf1be',
|
||||
fillColor: "white", coordOrigin: '0 0', coordSize: '200 200'
|
||||
};
|
||||
for (var key in attributes) {
|
||||
defaultAttributes[key] = attributes[key];
|
||||
}
|
||||
@ -34,6 +36,7 @@ web2d.Workspace = new Class({
|
||||
getType: function () {
|
||||
return "Workspace";
|
||||
},
|
||||
|
||||
/**
|
||||
* Appends an element as a child to the object.
|
||||
*/
|
||||
@ -154,7 +157,7 @@ web2d.Workspace = new Class({
|
||||
if (style != 'solid') {
|
||||
throw 'Not supported style stroke style:' + style;
|
||||
}
|
||||
this._htmlContainer.css('border',width + ' ' + style + ' ' + color);
|
||||
this._htmlContainer.css('border', width + ' ' + style + ' ' + color);
|
||||
|
||||
if (opacity || opacity === 0) {
|
||||
throw "Unsupported operation. Opacity not supported.";
|
||||
|
Loading…
Reference in New Issue
Block a user