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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion js/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class Browser {
*/
toSVG() {

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

const h_render = 8000

Expand Down Expand Up @@ -412,6 +412,8 @@ class Browser {
trackView.renderSVGContext(context, delta)
}

// ROI -> SVG
delta.deltaX = x
this.roiManager.renderSVGContext(context, delta)

// reset height to trim away unneeded svg canvas real estate. Yes, a bit of a hack.
Expand Down
4 changes: 2 additions & 2 deletions js/roi/ROIManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,13 @@ class ROIManager {
// body
const { x, y, width, height } = regionElement.getBoundingClientRect()
context.fillStyle = regionElement.style.backgroundColor
context.fillRect(x+deltaX, y+deltaY, width, height)
context.fillRect(x-deltaX, y+deltaY, width, height)

// header
const header = regionElement.querySelector('div')
const { x:xx, y:yy, width:ww, height:hh } = header.getBoundingClientRect()
context.fillStyle = header.style.backgroundColor
context.fillRect(xx+deltaX, yy+deltaY, ww, hh)
context.fillRect(xx-deltaX, yy+deltaY, ww, hh)
}
}

Expand Down
Loading