Commit graph

948 commits

Author SHA1 Message Date
Simon Hausmann
8edb9bd7f8 Implement a layout function to position items on a path
This is very simple still, always starts at the beginning of the path
and uses equal distances.
2020-07-09 15:26:52 +02:00
Simon Hausmann
a679f33871 Process path elements in PathLayout
Collect them and assign them to an "elements" property, like with Path {}.

Also process paths before layouts.
2020-07-09 14:18:27 +02:00
Simon Hausmann
5e8d23a287 Accept PathLayout just by syntax 2020-07-09 14:18:26 +02:00
Simon Hausmann
251ef7fc97 Add support for SVG commands in Path elements
Using the commands property we can just paste SVG paths. This makes it
much easier to write examples/demos. A good online path designer is
for example https://codepen.io/anthonydugois/pen/mewdyZ
2020-07-09 13:41:57 +02:00
Simon Hausmann
be60079f21 Add support for pre-compiled paths
They are represented as lyon-style path events. We can use this to
compile SVG paths ahead of time and use them
without including lyon's SVG path builder.
2020-07-09 10:43:49 +02:00
Simon Hausmann
c17c06c6e7 Making closing of a path optional
By default paths are not closed and they can be closed using a Close {}
element.
2020-07-09 09:52:09 +02:00
Simon Hausmann
f45ff6ce79 Add support for stroking paths
This will make it easier to visualize the path for layouts.
2020-07-09 09:36:16 +02:00
Simon Hausmann
dfe95a2f6d Allow rendering primitives to break down into multiple GL primitives
This is in preparation for path stroking and filling.
2020-07-09 09:10:55 +02:00
Simon Hausmann
5629683942 Remove PathElements::as_slice()
This function is not needed anymore
2020-07-09 08:54:19 +02:00
Simon Hausmann
afa23faa94 Move the path building function into corelib
We're going to need it not only in the GL renderer but also in the layout code.
2020-07-08 20:36:40 +02:00
Simon Hausmann
7c8cd63ddc Fix formatting 2020-07-08 20:26:28 +02:00
Simon Hausmann
32f9f4117f Upgrade to a new upstream glow version
This includes our fix for the texture creation from canvas, and requires
a little source compatibility fix.
2020-07-08 20:25:40 +02:00
Simon Hausmann
8c7068ebfc Fix spurious test failures with type hierarchies
Make sure the error output is always the same and doesn't depend on the randomness
of HashSet.
2020-07-08 10:24:13 +02:00
Simon Hausmann
7f3d1c3633 Small typo fix 2020-07-08 09:11:14 +02:00
Simon Hausmann
a5a9552557 Minor type registry cleanup
Collect all path elements in one slice, for easier re-use.
2020-07-08 09:09:06 +02:00
Simon Hausmann
c6c0f1f589 Make path arc rendering more robust
Some arcs may not result in any content, for example if the radius is too small
or start and end pointer overlap. Let Lyon do the
checking for us and handle it accordingly.

Newer versions of Lyon will allow the re-use of the SvgArc created temporarily.
2020-07-08 08:42:01 +02:00
Simon Hausmann
4c0755d6cc Change the way boolean literals are implemented
Instead of catching them at parsing time, catch them when trying to convert a qualified name node into an expression.
2020-07-07 22:53:35 +02:00
Simon Hausmann
22d838ffae Add support for true and false boolean literals 2020-07-07 22:11:41 +02:00
Simon Hausmann
f03ba40d50 Fix spurious test failures
The accepted child element types are stored in a hash map, so sort them
as part of the error message.
2020-07-07 18:21:59 +02:00
Simon Hausmann
89a05245f9 Fix SharedArray length in bytes to be a multiple of pointer alignment 2020-07-07 18:15:26 +02:00
Simon Hausmann
f646809ff4 Added ArcTo element for paths 2020-07-07 16:02:46 +02:00
Simon Hausmann
a83127ace8 Prepare the path element compilation for extensibility
Avoid any element specific code in the Rust and C++ generator and
minimize the involvement in the interpreter.
2020-07-07 14:14:17 +02:00
Simon Hausmann
1ab71b8ca3 Prepare the path element setup in the run-time for extensibility
Make the anonymous struct for the LineTo variant in the PathElement enum
as separate structure, which can be introspected using rtto::FieldInfo.
2020-07-07 14:14:17 +02:00
Simon Hausmann
9d9779ecde Fix linter warning
When docs are required, don't require them for the generated field offset module.
2020-07-07 14:14:17 +02:00
Simon Hausmann
9a73443e14 Allow for path elements to contain bindings 2020-07-07 14:14:17 +02:00
Simon Hausmann
9cf2d618d2 Use Lyon's path builder
Instead of trying to convert the individual (future) elements, let's use a builder.
This way the markup remains simple and due to
future support for bindings we can't really
pre-compute the path events anyway.
2020-07-07 14:14:17 +02:00
Simon Hausmann
fdf7169459 Fix is_constant for Expression::PathElements
Respect the constant'ness of the contained expressions.
2020-07-07 14:14:17 +02:00
Simon Hausmann
a71c67152e Revert "Prepare for additional path elements"
This reverts commit d143addb07.

We're going to need to support binding expressions in path elements.
2020-07-07 14:14:17 +02:00
Olivier Goffart
d0b44a125d Support for if expression in the interpreter
Dynamic model or expression not yet supported
2020-07-03 17:56:48 +02:00
Olivier Goffart
90532e80d2 C++: Support of dynamic model and if expression 2020-07-03 17:37:07 +02:00
Olivier Goffart
20369c7fc7 Fix nested components 2020-07-03 14:04:51 +02:00
Olivier Goffart
1cbd522a03 Rust: make non-constant model and if expression work 2020-07-03 14:04:23 +02:00
Olivier Goffart
769474a478 Introduce a property listener 2020-07-03 13:02:50 +02:00
Olivier Goffart
b529a021a2 Fix bug in the property linked list
Not having a prev can happen if the property itsalf was destroyed.
2020-07-02 18:08:46 +02:00
Olivier Goffart
90ed79e39f Remove unused code in the animation driver 2020-07-02 17:36:34 +02:00
Olivier Goffart
055a3baf90 Remove the binding when the animation on value is finished. 2020-07-02 17:28:04 +02:00
Olivier Goffart
9d852f802e Property refactoring
The tests are working and everything seems to be back normal.
But there is still some cleanup required
2020-07-02 14:14:49 +02:00
Simon Hausmann
facc18d0eb Fix formatting
RA stopped working for some odd reason :-/
2020-07-02 11:25:29 +02:00
Simon Hausmann
d143addb07 Prepare for additional path elements
Require that the values to the path element properties are numerical literals.
The conversion happens in the path "compilation" pass, where we can do more
pre-calcuation in the future.
2020-07-02 10:40:31 +02:00
Simon Hausmann
196aef5fbe Fix C++ linkage on Linux
Apply the same workaround for missing symbol exports as in commit
54f81d4d29
2020-07-02 09:10:06 +02:00
Simon Hausmann
9bf3533c9b Fix C++ build
Accidentally remove the .h extension from the color generated header file :)
2020-07-02 08:56:34 +02:00
Simon Hausmann
e54931ea9b Remove stray debug output 2020-07-02 08:50:16 +02:00
Simon Hausmann
5e61ed4ad2 Implement Path and LineTo in the markup 2020-07-01 15:13:23 +02:00
Simon Hausmann
4e22c2839e Add the rendering primitives for rendering a path
Right now the path is limited to polygons (only LineTo elements) and only the fill color can be specified.
2020-07-01 14:58:09 +02:00
Simon Hausmann
e4ab64f858 Add a SharedArray type
This is based on the SharedString code and will allow sharing ownership
of arrays between Rust and C++.
2020-07-01 14:58:09 +02:00
Olivier Goffart
6863c3f631 Use scoped_thread_local for the CURRENT_BINDING 2020-06-30 10:11:34 +02:00
Olivier Goffart
009addf9b4 Logical operations and comparisons and unary operators 2020-06-29 18:40:37 +02:00
Olivier Goffart
c4b1feeea0 Parse Equality opreration
(Code generation still missing)
2020-06-29 18:40:37 +02:00
Simon Hausmann
c653f555ea Begin parsing Path elements
As types they follow the regular syntax convention of elements and
properties, but they are contextually restricted.
2020-06-29 16:48:20 +02:00
Simon Hausmann
38b605998c Fix build 2020-06-29 16:44:54 +02:00