Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bounding box moves when moving a symbol in Firefox and Safari #284

Closed
adrianbj opened this issue Sep 13, 2018 · 2 comments
Closed

Bounding box moves when moving a symbol in Firefox and Safari #284

adrianbj opened this issue Sep 13, 2018 · 2 comments
Labels

Comments

@adrianbj
Copy link
Contributor

adrianbj commented Sep 13, 2018

Describe the bug
Bounding box moves when moving a symbol in Firefox and Safari. Note that it's fine in Chrome these days, but in 2.5 is was a bug in Chrome as well.

To Reproduce
Steps to reproduce the behavior:

  1. Insert an IAN symbol
  2. Click and drag to move it

Expected behavior
Bounding box should stay with the symbol

Screenshots
image

@brettz9 brettz9 added the bug label Sep 13, 2018
@sbrown345
Copy link
Contributor

sbrown345 commented Apr 10, 2020

Method Draw has it fixed and this worked on my old branch. Replace the code in the default case:

https://github.com/methodofaction/Method-Draw/blob/de8eb4c6954e3dd1b71e06cdcece41f13d80d891/editor/src/svgutils.js#L494

    if(elname === 'use') {
      ret = groupBBFix(selected, true);
    }
    
    if(elname === 'use') {
      if(!ret) ret = selected.getBBox();
      //if(!svgedit.browser.isWebkit()) {
      //  var bb = {};
      //  bb.width = ret.width;
      //  bb.height = ret.height;
      //  bb.x = ret.x + parseFloat(selected.getAttribute('x')||0);
      //  bb.y = ret.y + parseFloat(selected.getAttribute('y')||0);
      //  ret = bb;
      //}
    } else if(~visElems_arr.indexOf(elname)) {
      try { ret = selected.getBBox();} 
      catch(e) { 
        // Check if element is child of a foreignObject
        var fo = $(selected).closest("foreignObject");
        if(fo.length) {
          try {
            ret = fo[0].getBBox();
          } catch(e) {
            ret = null;
          }
        } else {
          ret = null;
        }
      }

@AgriyaDev5
Copy link
Contributor

Before

Screenshot at 2021-06-08 18:52:58

After

Screenshot at 2021-06-08 18:49:13

jfhenon added a commit that referenced this issue Jun 8, 2021
#284 Bounding box moves when moving a symbol
@jfhenon jfhenon closed this as completed Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants