miroiu / nodify

Highly performant and modular controls for node-based editors designed for data-binding and MVVM.
https://miroiu.github.io/nodify
MIT License
1.3k stars 208 forks source link

[Question] Is it possible to snap selection rectangle #39

Closed wrekklol closed 1 year ago

wrekklol commented 1 year ago

Hello. I was wondering if it is possible to make the selection rectangle snap to the/a grid? Doing an image editor currently, and I'm trying to get it to snap to the pixels but it seems like it is not possible currently? Not that experienced with WPF yet. :)

Also, is it possible to use the selection as a dependencyobject? I'm trying to do marching ants on the selection as well.

wrekklol commented 1 year ago

Got the first thing working by setting UseLayoutRounding on the selection style. Now I'm just trying to figure out how to use animations on it. Nvm, sorry got that working as well. :)

miroiu commented 1 year ago

Hi! Your use case is interesting but I'm not sure how much of Nodify you can use for an image editor. It is not possible to snap the selection rectangle to the grid at the moment. And as you may already have figured out, you can override the selection rectangle style to implement marching ants. (I created a PR to demonstrate that)

wrekklol commented 1 year ago

The graph editor is what I use Nodify for currently, because it "just works". :)

miroiu commented 1 year ago

That's really cool! I am curious what package version you use. There are a lot of improvements in v2 but it has many breaking changes. I created a changelog for that.

wrekklol commented 1 year ago

I'm using the master branch from about 3 weeks ago. :)