diff --git a/src/lib/editor/editor.component.ts b/src/lib/editor/editor.component.ts index bae0665..05b40f9 100644 --- a/src/lib/editor/editor.component.ts +++ b/src/lib/editor/editor.component.ts @@ -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 = ( cell).getBBox().topRight().offset(-error.get('size').width, 0); - error.set('position', pt); - (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); } } diff --git a/src/lib/shared/shapes.ts b/src/lib/shared/shapes.ts index 6897561..14af41d 100644 --- a/src/lib/shared/shapes.ts +++ b/src/lib/shared/shapes.ts @@ -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 || ( 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); }