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

WI00761833 - Updates for Blazor Diagrams mouse configuration #45

Conversation

shams-azam-wtg
Copy link

  • Added documentation for scroll behavior
  • Fixed scrolling of page with diagram when scrolling insied a diagrm by adding a js function in script.js to implement preventDefault.
  • updated minimized js of script.js to script.min.js as just adding to script.js was not working when tested locally.

src/Blazor.Diagrams/Components/DiagramCanvas.razor.cs Outdated Show resolved Hide resolved
src/Blazor.Diagrams/Extensions/JSRuntimeExtensions.cs Outdated Show resolved Hide resolved
Comment on lines 126 to 127
Diagram.UnregisterBehavior<WheelBehavior>();
Diagram.RegisterBehavior(new ScrollBehavior(Diagram));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not enable scroll on wheel behavior.
We need to use the diagram BehaviorOptions to configure what action scrolls the diagram. I think BehaviorOptions is what we need to document here.
e.g. to scroll on wheel for a diagram, use _diagram.BehaviorOptions.DiagramWheelBehavior = _diagram.GetBehavior<ScrollBehavior>();

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

src/Blazor.Diagrams/Components/DiagramCanvas.razor.cs Outdated Show resolved Hide resolved
Copy link

@Heathermcx Heathermcx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Shams, the functionality works well now, nice work.
I think we can improve the documentation some more.

@@ -114,6 +114,19 @@ Diagram.UnregisterBehavior&lt;SelectionBehavior&gt;();
Diagram.RegisterBehavior(new MySelectionBehavior(Diagram));
</code></pre>

<h2>Using Different Behaviors</h2>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Different Behaviors seems like a duplicate of the above section, Replacing a behavior. I think what we really want to document here is how to configure behaviors use DiagramBehaviorOptions which is a class we added. This class allows the user to configure some of the standard behaviors to be on different inputs. This is different to using a different behavior/replacing a behavior.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check with Matt if not sure how DiagramBehaviorOptions works.

Copy link

@Heathermcx Heathermcx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@shams-azam-wtg shams-azam-wtg merged commit 1d5a782 into master Jul 15, 2024
2 checks passed
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