-
Notifications
You must be signed in to change notification settings - Fork 31
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
[FEAT] Fit center the viewport on diagram load #836
[FEAT] Fit center the viewport on diagram load #836
Conversation
47f34e8
to
25908e0
Compare
65503cc
to
8be617b
Compare
8be617b
to
ec59649
Compare
const width = bounds.width / this.view.scale; | ||
const height = bounds.height / this.view.scale; | ||
const scale = Math.min(max, Math.min(clientWidth / width, clientHeight / height)); | ||
this.cumulativeZoomFactor = scale; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is required for consistency with the zoom code.
Do we need automatic test for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @aibcmars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we should have a test who mix zoom & fit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be managed with #844
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com>
a12ec9a
to
ed0dd98
Compare
test/e2e/bpmn.navigation.test.ts
Outdated
@@ -31,7 +31,7 @@ interface MouseWheelOptions { | |||
*/ | |||
deltaY?: number; | |||
} | |||
interface MouseWithWheel extends Mouse { | |||
export interface MouseWithWheel extends Mouse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ we should probably put this definition in a dedicated file to avoid dependencies between test files whereas they have no relation
viewportCenterY = bounding_box.y + bounding_box.height / 2; | ||
}); | ||
|
||
it(`ctrl + mouse: initial scale after zoom in and zoom out`, async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ I don't understand the title
It seems to me that we do fit on load then zoom. Is that correct? if so, the title is not clear IMHO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, we will work on this with #844
dcb4968
to
ed0dd98
Compare
Covers #775