Merged in bugfix/relationships (pull request #18)

Relationships fixes
* Fix event trigger with custom data. This was causing an error when adding relationships
* Fix save after deleting a relationship
* Disallow relationship edit when in readOnly mode
* Fix typos

* Update snapshots from docker


Approved-by: Paulo Veiga
This commit is contained in:
Matias Arriola 2021-12-29 18:10:35 +00:00 committed by Paulo Veiga
parent e32836c430
commit 89765aa93d
34 changed files with 28 additions and 10 deletions

View File

@ -1,5 +1,5 @@
{
"name": "wisemapping-font-end",
"name": "wisemapping-front-end",
"scripts": {
"bootstrap": "lerna bootstrap",
"build": "lerna run build",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View File

@ -79,7 +79,7 @@ class Designer extends Events {
// Init Screen manager..
const screenManager = new ScreenManager(divElement);
this._workspace = new Workspace(screenManager, this._model.getZoom());
this._workspace = new Workspace(screenManager, this._model.getZoom(), !!options.readOnly);
// Init layout manager ...
this._eventBussDispatcher = new EventBusDispatcher(this.getModel());

View File

@ -169,7 +169,11 @@ class Relationship extends ConnectionLine {
workspace.append(this._controlPointsController);
this._controlPointControllerListener = this._initializeControlPointController.bind(this);
this._line2d.addEvent('click', this._controlPointControllerListener);
if (workspace.isReadOnly) {
this._line2d.setCursor('default');
} else {
this._line2d.addEvent('click', this._controlPointControllerListener);
}
this._isInWorkspace = true;
workspace.append(this._startArrow);
@ -187,7 +191,9 @@ class Relationship extends ConnectionLine {
removeFromWorkspace(workspace) {
workspace.removeChild(this._focusShape);
workspace.removeChild(this._controlPointsController);
this._line2d.removeEvent('click', this._controlPointControllerListener);
if (!workspace.isReadOnly) {
this._line2d.removeEvent('click', this._controlPointControllerListener);
}
this._isInWorkspace = false;
workspace.removeChild(this._startArrow);
if (this._endArrow) workspace.removeChild(this._endArrow);

View File

@ -19,13 +19,14 @@ import { $assert, $defined } from '@wisemapping/core-js';
import { Workspace as Workspace2D, Toolkit } from '@wisemapping/web2d';
class Workspace {
constructor(screenManager, zoom) {
constructor(screenManager, zoom, isReadOnly) {
// Create a suitable container ...
$assert(screenManager, 'Div container can not be null');
$assert(zoom, 'zoom container can not be null');
this._zoom = zoom;
this._screenManager = screenManager;
this._isReadOnly = isReadOnly;
const divContainer = screenManager.getContainer();
this._screenWidth = parseInt(divContainer.css('width'), 10);
@ -44,6 +45,10 @@ class Workspace {
this._eventsEnabled = true;
}
get isReadOnly() {
return this._isReadOnly;
}
_createWorkspace() {
// Initialize workspace ...
const coordOriginX = -(this._screenWidth / 2);

View File

@ -150,7 +150,7 @@ class Mindmap extends IMindmap {
* @param relationship
*/
deleteRelationship(relationship) {
this._relationships = this._branches.filter((r) => r !== relationship);
this._relationships = this._relationships.filter((r) => r !== relationship);
}
findNodeById(id) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 KiB

After

Width:  |  Height:  |  Size: 321 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 KiB

After

Width:  |  Height:  |  Size: 296 KiB

View File

@ -34,6 +34,9 @@ class ElementPeer {
this._size = { width: 1, height: 1 };
this._changeListeners = {};
// http://support.adobe.com/devsup/devsup.nsf/docs/50493.htm
// __handlers stores handlers references so they can be removed afterwards
this.__handlers = new Map();
}
setChildren(children) {
@ -95,12 +98,15 @@ class ElementPeer {
* http://developer.mozilla.org/en/docs/addEvent
*/
addEvent(type, listener) {
this._native.addEventListener(type, listener);
// wrap it so it can be ~backward compatible with jQuery.trigger
const wrappedListener = (e) => listener(e, e.detail);
this.__handlers.set(listener, wrappedListener);
this._native.addEventListener(type, wrappedListener);
}
trigger(type, event) {
// TODO: check this for correctness and for real jQuery.trigger replacement
this._native.dispatchEvent(new CustomEvent(type, event));
this._native.dispatchEvent(new CustomEvent(type, { detail: event }));
}
// eslint-disable-next-line class-methods-use-this
@ -109,7 +115,8 @@ class ElementPeer {
}
removeEvent(type, listener) {
this._native.removeEventListener(type, listener);
this._native.removeEventListener(type, this.__handlers.get(listener));
this.__handlers.delete(listener);
}
setSize(width, height) {

View File

@ -1,6 +1,6 @@
# Running tests with cypress.
For details on why we picked Cypress, check the following [PR](https://bitbucket.org/wisemapping/wisemapping-react/pull-requests/1)
For details on why we picked Cypress, check the following [PR](https://bitbucket.org/wisemapping/wisemapping-frontend/pull-requests/1)
Check the [Cypress docs](https://docs.cypress.io/guides/overview/why-cypress.html) for more information

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 54 KiB