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

fix ROI shift issue when saving svg #1742

Merged
merged 2 commits into from
Dec 15, 2023
Merged

Conversation

wilsonGen
Copy link
Contributor

Fix ROI shift issue when saving svg:

Issue:
When the IGV browser is not stick to the left of the web page, the saved SVG will have the ROI shifted:
how the IGV place in the webpage:
Screenshot 2023-12-12 122912
the output SVG from IGV:
Screenshot 2023-12-12 122941

If the IGV browser is stick to the left of the webpage like this👇, then the ROI in SVG will be normal
Screenshot 2023-12-12 163438

Work around:
Minus the columnContainer's clientX when rendering SVG rect of ROI instead of just using the regionElement's clientX

jrobinso added a commit that referenced this pull request Dec 14, 2023
@jrobinso jrobinso requested a review from turner December 14, 2023 19:27
@turner
Copy link
Contributor

turner commented Dec 14, 2023

@wilsonGen functionally it looks correct. It might be a bit cleaner to do this:

In browser.js

const {x, y, width, height} = this.columnContainer.getBoundingClientRect()

delta.deltaX = x
this.roiManager.renderSVGContext(context, delta)

and in ROIManager.js the calls to fillRect look like this:

renderSVGContext(context, {deltaX, deltaY}) {


    context.fillRect(x-deltaX, y+deltaY, width, height)
    
    
    context.fillRect(xx-deltaX, yy+deltaY, ww, hh)
}

@wilsonGen
Copy link
Contributor Author

@turner Oh right, this is much cleaner, thank you for the suggestions.

@jrobinso jrobinso merged commit 4b54991 into igvteam:master Dec 15, 2023
1 check passed
@jrobinso
Copy link
Contributor

@wilsonGen Thanks for the fix

github-actions bot pushed a commit to arpanda/igv.js that referenced this pull request Apr 2, 2024
github-actions bot pushed a commit to arpanda/igv.js that referenced this pull request Apr 2, 2024
* fix ROI shift issue when saving svg

* cleaner solution suggested by Turner
jrobinso added a commit that referenced this pull request May 19, 2024
jrobinso pushed a commit that referenced this pull request May 19, 2024
* fix ROI shift issue when saving svg

* cleaner solution suggested by Turner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants