elsa-workflows/elsa-designer

lastClickedLocation not set correctly

martin-indexeb opened this issue · 1 comments

Hi,

Can I suggest a change to the Designer onAddActivityClick event? I found that el.offsetLeft and el.offsetTop were being calculated relative to the parent element, which was already offset in the page (which led to the new elements disappearing as they were rendered off to the right). I amended the call to use getBoundingClientRect which is working okay on my dev install...

  private onAddActivityClick = (e: MouseEvent) => {
    const el = this.elem() as HTMLElement;
    const clientRect = el.getBoundingClientRect();
    this.lastClickedLocation = {
      left: e.pageX - clientRect.left,
      top: e.pageY - clientRect.top
    };
    this.addActivityEvent.emit();
  };

Just seen you have taken a different approach on the feature/2.0 branch. Feel free to ignore me ;-)