-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add zoom in/out/reset and fit option #39
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ html, body { | |
|
||
.graph { | ||
background:url('../images/grid.gif'); | ||
overflow: hidden; | ||
} | ||
|
||
.graph.hide-bg { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -431,6 +431,22 @@ graphs.createGraph = function createGraph (container, options, styles) { | |
}; | ||
graph.addListener(mxEvent.REFRESH, onRefresh); | ||
|
||
// * Adds mouse wheel handling for zoom | ||
mxEvent.addMouseWheelListener(function(evt, up) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the direction my mouse wheel must move to move the pages' scrollbar up. I think that is the default configuration. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see thanks. Please document that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a comment explaining |
||
// - `up = true` direction: | ||
// Moves the viewport closer to the graph; | ||
// When browsing a web page the vertical scrollbar will move up; | ||
// - `up = false` direction: | ||
// Moves the viewport away from the graph; | ||
// When browsing a web page the vertical scrollbar will move down; | ||
if (up) { | ||
graph.zoomIn(); | ||
} else { | ||
graph.zoomOut(); | ||
} | ||
mxEvent.consume(evt); | ||
}); | ||
|
||
// DEBUG ------------------------------------------------------------------- | ||
|
||
graph.container.addEventListener( | ||
|
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.
Will we be able to do any extra work to save the final scene in the project file, with pans, zooms and whatever changes the user made?
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 went to actually check that since I was expecting it to already be saved on
dump
but it is not.It should be easy since we can obtain all that data.
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.
👍
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.
Added
get_scale_and_translation
/set_scale_and_translation
to abstract the order pan and zoom are applied.