|Layout behaving like view in a 2D-CAD program||audiowerk||5/16/14 12:13 PM|
I'm in need of a layout without boundaries. It should behave like the view in a 2D-CAD program. That means that i want to
I already experimented with the ScatterLayout, but it seems to have different behavior.
Do you have any ideas how i could relize this?
Thanks for any help in advance!
|Re: Layout behaving like view in a 2D-CAD program||Amirouche Boubekki||5/21/14 4:03 PM|
I tried something, checkout the screenshot.
In principle the scatter widget allows to scale, rotate and translate. Changing size of markers should work but I did not test it. Translation works as expected.
Zooming is not implemented at all «zoom in and out by touch or mouse scroll, with all the children getting smaller or bigger»
But moving on the blueprint is possible as expected.
I tried with a relative layout but failed, it might possible, and would allow to keep the code simpler with other tradeoffs maybe.
- The grid is implemented with kivy.graphics.Line on_touch_move, I redraw the texture with the a new Grid.origin position.
- Marker's position as marker.pos doesn't change when you move the grid,
- look at the end of Grid.redraw, it adds the markers to the canvas which was cleared at the beginning.
- It is all based on window coordinates, except grid texture which relies on Grid.origin to draw the Line axis correctly.
- The positions you see displayed, are never actual position of Kivy widgets, except if you start the with a Grid(origin=(0, 0)).
I tried to get the grid lines thiner, but I couldn't, a problem with dpi settings? Inkscape has thiner grid lines.
There is quiet a few things to improve in terms of performance, but so far so good.
It is at bitbucket
Clone with this command:
hg clone https://bitbucket.org/amirouche/antiquote
Tell me how it goes on your side. It requires Python 3 and Kivy 1.8.0. You can probably get it working on Python 2, I think that only super() calls are not backward compatible.
|Re: Layout behaving like view in a 2D-CAD program||audiowerk||5/23/14 6:29 PM|
thanks for your help and giving it a try! Because of the performance problems i thought of drawing a large (but not infinite) grid only once and then scale and translate it. This looks like this:
this works, but i have the problem, that the first button doesnt work. it makes sense that it doesn't, but i don't know how to bring it to front or fix it.
is there any way to cut the collide_point in general similar to StencilView for canvas?
do you have any other suggestions to fix this?
thanks for any help!
|Re: Layout behaving like view in a 2D-CAD program||audiowerk||5/23/14 7:06 PM|
i could fix the problem with a custom scatter and a new collide_pont function: