Error marker location opened. Error marker css class toggles.

This commit is contained in:
BoykoAlex
2019-11-22 12:52:55 -05:00
parent 7f48adf92e
commit c1348124a9
2 changed files with 11 additions and 12 deletions

View File

@@ -893,16 +893,13 @@ export class EditorComponent implements OnInit, OnDestroy {
kind: Constants.ERROR_DECORATION_KIND,
messages: errorMessages
});
let pt: dia.Point;
const view = this.paper.findViewByModel(error);
if (cell instanceof joint.dia.Element) {
pt = (<dia.Element> cell).getBBox().topRight().offset(-error.get('size').width, 0);
error.set('position', pt);
(<dia.ElementView>view).setInteractivity(false);
} else {
// TODO: do something for the link perhaps?
}
view.setInteractivity(false);
}
const cellView = this.paper.findViewByModel(cell);
if (cellView) {
joint.V(cellView.el).toggleClass('marker-error', errorMessages.length);
}
}

View File

@@ -651,9 +651,6 @@ export namespace Shapes {
let location = params.position;
let graph = params.graph || (params.paper ? params.paper.model : undefined);
if (!location) {
location = {x: 0, y: 0};
}
let decoration: dia.Element;
if (renderer && _.isFunction(renderer.createDecoration)) {
decoration = renderer.createDecoration(kind, parent);
@@ -663,9 +660,14 @@ export namespace Shapes {
image: { 'xlink:href': DECORATION_ICON_MAP.get(kind) },
}
});
if (parent instanceof joint.dia.Element) {
const pt = location || (<dia.Element> parent).getBBox().topRight().offset(-decoration.size().width, 0);
decoration.position(pt.x, pt.y);
} else {
// TODO: do something for the link perhaps?
}
}
decoration.set('type', joint.shapes.flo.DECORATION_TYPE);
decoration.set('position', location);
if ((isChrome || isFF) && parent && typeof parent.get('z') === 'number') {
decoration.set('z', parent.get('z') + 1);
}