mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Fix map loading
This commit is contained in:
parent
025e4714e9
commit
c9cac78d2d
6
libraries/bootstrap.js
vendored
Normal file
6
libraries/bootstrap.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
import { $assert } from "@wisemapping/core-js";
|
import { $assert } from "@wisemapping/core-js";
|
||||||
|
|
||||||
|
|
||||||
class CommandContext {
|
class CommandContext {
|
||||||
constructor(designer) {
|
constructor(designer) {
|
||||||
$assert(designer, 'designer can not be null');
|
$assert(designer, 'designer can not be null');
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import { $assert, $defined } from '@wisemapping/core-js';
|
||||||
import web2d from '@wisemapping/web2d';
|
import web2d from '@wisemapping/web2d';
|
||||||
|
|
||||||
import INodeModel, { TopicShape } from './model/INodeModel';
|
import INodeModel, { TopicShape } from './model/INodeModel';
|
||||||
@ -24,14 +25,14 @@ const ConnectionLine = new Class({
|
|||||||
initialize(sourceNode, targetNode, lineType) {
|
initialize(sourceNode, targetNode, lineType) {
|
||||||
$assert(targetNode, 'parentNode node can not be null');
|
$assert(targetNode, 'parentNode node can not be null');
|
||||||
$assert(sourceNode, 'childNode node can not be null');
|
$assert(sourceNode, 'childNode node can not be null');
|
||||||
$assert(sourceNode != targetNode, 'Circular connection');
|
$assert(sourceNode !== targetNode, 'Circular connection');
|
||||||
|
|
||||||
this._targetTopic = targetNode;
|
this._targetTopic = targetNode;
|
||||||
this._sourceTopic = sourceNode;
|
this._sourceTopic = sourceNode;
|
||||||
|
|
||||||
let line;
|
let line;
|
||||||
const ctrlPoints = this._getCtrlPoints(sourceNode, targetNode);
|
const ctrlPoints = this._getCtrlPoints(sourceNode, targetNode);
|
||||||
if (targetNode.getType() == INodeModel.CENTRAL_TOPIC_TYPE) {
|
if (targetNode.getType() === INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
line = this._createLine(lineType, ConnectionLine.CURVED);
|
line = this._createLine(lineType, ConnectionLine.CURVED);
|
||||||
line.setSrcControlPoint(ctrlPoints[0]);
|
line.setSrcControlPoint(ctrlPoints[0]);
|
||||||
line.setDestControlPoint(ctrlPoints[1]);
|
line.setDestControlPoint(ctrlPoints[1]);
|
||||||
@ -59,7 +60,7 @@ const ConnectionLine = new Class({
|
|||||||
if (!$defined(lineType)) {
|
if (!$defined(lineType)) {
|
||||||
lineType = defaultStyle;
|
lineType = defaultStyle;
|
||||||
}
|
}
|
||||||
lineType = parseInt(lineType);
|
lineType = parseInt(lineType, 10);
|
||||||
this._lineType = lineType;
|
this._lineType = lineType;
|
||||||
let line = null;
|
let line = null;
|
||||||
switch (lineType) {
|
switch (lineType) {
|
||||||
@ -124,7 +125,7 @@ const ConnectionLine = new Class({
|
|||||||
const targetTopicSize = targetTopic.getSize();
|
const targetTopicSize = targetTopic.getSize();
|
||||||
let y;
|
let y;
|
||||||
let x;
|
let x;
|
||||||
if (targetTopic.getShapeType() == TopicShape.LINE) {
|
if (targetTopic.getShapeType() === TopicShape.LINE) {
|
||||||
y = targetTopicSize.height;
|
y = targetTopicSize.height;
|
||||||
} else {
|
} else {
|
||||||
y = targetTopicSize.height / 2;
|
y = targetTopicSize.height / 2;
|
||||||
@ -197,9 +198,7 @@ const ConnectionLine = new Class({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
ConnectionLine.getStrokeColor = function () {
|
ConnectionLine.getStrokeColor = () => '#495879';
|
||||||
return '#495879';
|
|
||||||
};
|
|
||||||
|
|
||||||
ConnectionLine.SIMPLE = 0;
|
ConnectionLine.SIMPLE = 0;
|
||||||
ConnectionLine.POLYLINE = 1;
|
ConnectionLine.POLYLINE = 1;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import web2d from '@wisemapping/web2d';
|
import web2d from '@wisemapping/web2d';
|
||||||
|
import { $defined } from '@wisemapping/core-js';
|
||||||
|
|
||||||
import Shape from './util/Shape';
|
import Shape from './util/Shape';
|
||||||
import ActionDispatcher from './ActionDispatcher';
|
import ActionDispatcher from './ActionDispatcher';
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import { $assert } from "@wisemapping/core-js";
|
||||||
import web2d from '@wisemapping/web2d';
|
import web2d from '@wisemapping/web2d';
|
||||||
|
|
||||||
const Icon = new Class({
|
const Icon = new Class({
|
||||||
@ -50,7 +51,7 @@ const Icon = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
remove() {
|
remove() {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { $assert } from '@wisemapping/core-js';
|
import { $assert } from '@wisemapping/core-js';
|
||||||
|
import $ from '@libraries/jquery-2.1.0';
|
||||||
import Icon from './Icon';
|
import Icon from './Icon';
|
||||||
import FloatingTip from './widget/FloatingTip';
|
import FloatingTip from './widget/FloatingTip';
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import { $assert, $defined } from "@wisemapping/core-js";
|
||||||
|
import $ from '@libraries/jquery-2.1.0';
|
||||||
|
|
||||||
class FeatureModel {
|
class FeatureModel {
|
||||||
/**
|
/**
|
||||||
@ -41,7 +43,7 @@ class FeatureModel {
|
|||||||
|
|
||||||
/** */
|
/** */
|
||||||
setAttributes(attributes) {
|
setAttributes(attributes) {
|
||||||
for (key in attributes) {
|
for (const key in attributes) {
|
||||||
this[`set${key.capitalize()}`](attributes[key]);
|
this[`set${key.capitalize()}`](attributes[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable class-methods-use-this */
|
||||||
/*
|
/*
|
||||||
* Copyright [2015] [wisemapping]
|
* Copyright [2015] [wisemapping]
|
||||||
*
|
*
|
||||||
@ -15,6 +16,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import { $assert } from "@wisemapping/core-js";
|
||||||
|
|
||||||
class IMindmap {
|
class IMindmap {
|
||||||
getCentralTopic() {
|
getCentralTopic() {
|
||||||
@ -23,52 +25,52 @@ class IMindmap {
|
|||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
getDescription() {
|
getDescription() {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
setDescription(value) {
|
setDescription(value) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
getId() {
|
getId() {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
setId(id) {
|
setId(id) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
getVersion() {
|
getVersion() {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
setVersion(version) {
|
setVersion(version) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
addBranch(nodeModel) {
|
addBranch(nodeModel) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
getBranches() {
|
getBranches() {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
removeBranch(node) {
|
removeBranch(node) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
getRelationships() {
|
getRelationships() {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,27 +105,27 @@ class IMindmap {
|
|||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
hasAlreadyAdded(node) {
|
hasAlreadyAdded(node) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
createNode(type, id) {
|
createNode(type, id) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
createRelationship(fromNode, toNode) {
|
createRelationship(fromNode, toNode) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
addRelationship(rel) {
|
addRelationship(rel) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
deleteRelationship(relationship) {
|
deleteRelationship(relationship) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
@ -137,7 +139,7 @@ class IMindmap {
|
|||||||
|
|
||||||
for (let i = 0; i < branches.length; i++) {
|
for (let i = 0; i < branches.length; i++) {
|
||||||
const node = branches[i];
|
const node = branches[i];
|
||||||
if (i != 0) {
|
if (i !== 0) {
|
||||||
result = `${result},\n `;
|
result = `${result},\n `;
|
||||||
}
|
}
|
||||||
result = `${result}(${i}) =>${node.inspect()}`;
|
result = `${result}(${i}) =>${node.inspect()}`;
|
||||||
|
@ -224,7 +224,7 @@ class INodeModel {
|
|||||||
/** */
|
/** */
|
||||||
areChildrenShrunken() {
|
areChildrenShrunken() {
|
||||||
const result = this.getProperty('shrunken');
|
const result = this.getProperty('shrunken');
|
||||||
$defined(result) ? result : false;
|
return $defined(result) ? result : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,7 +250,7 @@ class INodeModel {
|
|||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
append(node) {
|
append(node) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -311,32 +311,32 @@ class INodeModel {
|
|||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
getPropertiesKeys() {
|
getPropertiesKeys() {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
putProperty(key, value) {
|
putProperty(key, value) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
setParent(parent) {
|
setParent(parent) {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
getChildren() {
|
getChildren() {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
getParent() {
|
getParent() {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @abstract */
|
/** @abstract */
|
||||||
clone() {
|
clone() {
|
||||||
throw 'Unsupported operation';
|
throw new Error('Unsupported operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import { $assert } from "@wisemapping/core-js";
|
||||||
import FeatureModel from './FeatureModel';
|
import FeatureModel from './FeatureModel';
|
||||||
|
|
||||||
class NoteModel extends FeatureModel {
|
class NoteModel extends FeatureModel {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import { $defined } from "@wisemapping/core-js";
|
||||||
import ModelCodeName from './ModelCodeName';
|
import ModelCodeName from './ModelCodeName';
|
||||||
import Beta2PelaMigrator from './Beta2PelaMigrator';
|
import Beta2PelaMigrator from './Beta2PelaMigrator';
|
||||||
import Pela2TangoMigrator from './Pela2TangoMigrator';
|
import Pela2TangoMigrator from './Pela2TangoMigrator';
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { createDocument, innerXML } from '@wisemapping/core-js';
|
import { $defined, $assert, createDocument, innerXML } from '@wisemapping/core-js';
|
||||||
import ModelCodeName from './ModelCodeName';
|
import ModelCodeName from './ModelCodeName';
|
||||||
import Mindmap from '../model/Mindmap';
|
import Mindmap from '../model/Mindmap';
|
||||||
import INodeModel from '../model/INodeModel';
|
import INodeModel from '../model/INodeModel';
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { $assert, createDocument } from '@wisemapping/core-js';
|
import { $assert, $defined, createDocument } from '@wisemapping/core-js';
|
||||||
import web2d from '@wisemapping/web2d';
|
import web2d from '@wisemapping/web2d';
|
||||||
import Mindmap from '../model/Mindmap';
|
import Mindmap from '../model/Mindmap';
|
||||||
import INodeModel, { TopicShape } from '../model/INodeModel';
|
import INodeModel, { TopicShape } from '../model/INodeModel';
|
||||||
|
@ -166,38 +166,9 @@ function loadDesignerOptions(jsonConf) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
global.editor = {};
|
|
||||||
global.editor.WaitDialog = new Class({
|
|
||||||
initialize() {
|
|
||||||
this.panel = this._buildPanel();
|
|
||||||
},
|
|
||||||
|
|
||||||
_buildPanel() {
|
|
||||||
const result = $('#load');
|
|
||||||
const content = result.find('.modal-content');
|
|
||||||
const winH = $(window).height();
|
|
||||||
// Set the popup window to center
|
|
||||||
content.css('margin-top', winH / 2 - content.height() / 2);
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
|
|
||||||
show() {
|
|
||||||
this.panel.modal({
|
|
||||||
backdrop: 'static',
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
close() {
|
|
||||||
this.panel.modal('hide');
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// Show loading dialog ...
|
// Show loading dialog ...
|
||||||
$(() => {
|
$(() => {
|
||||||
import('../../../../../../libraries/bootstrap').then(() => {
|
import('../../../../../../libraries/bootstrap').then(() => {
|
||||||
global.waitDialog = new global.editor.WaitDialog();
|
|
||||||
global.waitDialog.show();
|
|
||||||
|
|
||||||
// from viewmode.html ---------
|
// from viewmode.html ---------
|
||||||
var mapId = 'welcome';
|
var mapId = 'welcome';
|
||||||
// Set readonly option ...
|
// Set readonly option ...
|
||||||
@ -207,13 +178,7 @@ $(() => {
|
|||||||
|
|
||||||
// Load map from XML file persisted on disk...
|
// Load map from XML file persisted on disk...
|
||||||
var persistence = PersistenceManager.getInstance();
|
var persistence = PersistenceManager.getInstance();
|
||||||
var mindmap;
|
var mindmap = persistence.load(mapId);
|
||||||
try {
|
|
||||||
mindmap = persistence.load(mapId);
|
|
||||||
} catch (e) {
|
|
||||||
// If the map could not be loaded, create a new empty map...
|
|
||||||
mindmap = Mindmap.buildEmpty(mapId);
|
|
||||||
}
|
|
||||||
designer.loadMap(mindmap);
|
designer.loadMap(mindmap);
|
||||||
// from viewmode.html ---------
|
// from viewmode.html ---------
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user