Commit graph

948 commits

Author SHA1 Message Date
Simon Hausmann
76b1abce25 Try to install wasm-pack from pre-compiled binaries 2020-08-06 12:29:38 +02:00
Simon Hausmann
77009c010e Install wasm-pack "by hand"
As sometimes the github action gives a 404
2020-08-06 12:21:09 +02:00
Olivier Goffart
571e74d2ce Handle Touch event 2020-08-06 11:41:49 +02:00
Simon Hausmann
137ddb9bb8 Create missing dirs 2020-08-06 09:32:07 +02:00
Simon Hausmann
c5e31ebbd3 Try publishing the demo binaries 2020-08-06 09:11:21 +02:00
Simon Hausmann
7f8ab09f5a Do a full wasm-pack/webpack build of the gallery and printer demo in the CI 2020-08-06 08:51:02 +02:00
Olivier Goffart
479173c22f Implement spacing in GridLayout 2020-08-05 15:42:38 +02:00
Simon Hausmann
5e6bc55fe6 Reduce precision for the cubic easing curve
As suggested by Olivier. Also added another test.
2020-08-05 15:41:30 +02:00
Simon Hausmann
00b05bf891 Fix easing curves once more
Olivier is right, mixing t and x like that is not correct. Revert to the
previous formula with increased precision.
2020-08-05 15:32:58 +02:00
Simon Hausmann
3596059eab Add wasm build for the printer demo 2020-08-05 15:02:36 +02:00
Simon Hausmann
87cac657b2 Scale the icon size with the size of the window 2020-08-05 14:55:59 +02:00
Simon Hausmann
99c71cca05 Avoid jumps when using cubic easing curves
solve_t_for_x uses newton's method or binary search with the provided
tolerance to find t. The default tolerance is 0.1 and our control points
are between 0.1, so the resulting t is not very fine grained.

Instead, first go from t to x and then x becomes the new t for y.

The included but commented out test can be used to verify that the
curves are correct.
2020-08-05 14:51:07 +02:00
Simon Hausmann
f755518dd5 Fix value of width/height on the root item if not specified
Fixes the broken gallery :-)
2020-08-05 13:33:05 +02:00
Olivier Goffart
d43fcfe3ea Remove stray dbg! 2020-08-05 13:28:20 +02:00
Simon Hausmann
5dfb9aa875 Fix initialize size of printer demo
Map it to 800x600 logical pixels for a better initial look.

This implements respecting the initial values for width/height and tries
to apply them to the window begin created.

The PinnedOptionalProp wrapper is needed because while cbindgen mapped
the previous Option<&...> to a raw pointer, the new Option<Pin<&...>> is
not detected as a pointer.
2020-08-05 13:22:53 +02:00
Olivier Goffart
1741b90b4e Implement a SIXTYFPS_SLOW_ANIMATIONS env variable
that can be set to a factor to reduce the speed of animations
2020-08-05 13:21:29 +02:00
Olivier Goffart
121a6ba57d Try to re-enable Qt on the CI
Since there is more code, it probably will change the alignment of the metadata
2020-08-05 12:57:35 +02:00
Olivier Goffart
2dd3cecc5a Add a SpinBox 2020-08-05 12:56:13 +02:00
Olivier Goffart
6d0591a6f2 Add a helper function to add native types 2020-08-05 11:26:15 +02:00
Simon Hausmann
b6a5810bdc Fix wasm build 2020-08-05 11:10:39 +02:00
Olivier Goffart
38cd9158ac Report the error while building the Document node
Instead of panicking in later phase.

Use the same function in the syntax_tests that the one we use in the different
compiler frontend so that the problems would also be shown in the tests
2020-08-05 10:54:59 +02:00
Olivier Goffart
9bb6a1f2a1 Remove useless debug output 2020-08-05 10:54:59 +02:00
Simon Hausmann
fb763eeb8e Fix initial icon sizes
Now that the scale factor is initialized, these need adjusting.
2020-08-05 10:51:40 +02:00
Simon Hausmann
0f1b1fd0db Fix initial value of the scale factor window property
We need to initialize it property once we have a platform window.
2020-08-05 10:49:53 +02:00
Olivier Goffart
2dc1ef088e Compile 2020-08-05 10:36:41 +02:00
Simon Hausmann
d3c596669c Add larger icons to the printer demo
The icons on the main screen are now nicely large and they scale down on
activation.
2020-08-05 10:04:11 +02:00
Simon Hausmann
48df8d0911 Rework the API between the items and the renderer
Move fields out of the HighLevelRenderingPrimitive that are suitable to
represent as uniform variables. That reduces fields like Image or
Rectangle to their image or dimension, and only if *they* change, then
we re-do the work of building geometry and uploading it to the GPU.

Instead, the typically animated properties such as the position or the
color are passed separately with each draw call. This avoids re-decoding
PNG files and uploading them again when moving an image element around
on the screen.
2020-08-05 09:44:12 +02:00
Simon Hausmann
a9297af00d Update the rendering primitives lazily using a property listener scope
This also allows avoiding the need to store the high-level rendering
primitive item in the low-level primitive struct for comparison later.
2020-08-04 22:48:03 +02:00
Olivier Goffart
2518af41b1 Fix for in a declared component 2020-08-04 18:51:39 +02:00
Olivier Goffart
c9fab854e3 Some tweek in the animation 2020-08-04 18:18:55 +02:00
Olivier Goffart
0199b70cea if statements 2020-08-04 17:36:20 +02:00
Simon Hausmann
504b4a327b Provide the svg source for the image and a conversion script 2020-08-04 17:22:55 +02:00
Simon Hausmann
685a3fb8ab Rename Text::font_pixel_size to just font_size
Since length are resolution independent, it doesn't make sense anymore
to have the pixel infix.
2020-08-04 16:56:42 +02:00
Simon Hausmann
2b713eb341 Use a default font size that scales with the window scale factor
This is still coded in the backend but eventually we'll have default values
properties of items and then that can go there.
2020-08-04 16:53:48 +02:00
Simon Hausmann
4aed6ac6f3 Small touch-up on the rectangles 2020-08-04 16:37:10 +02:00
Simon Hausmann
67feaed237 Ignore a potential build directory 2020-08-04 16:09:33 +02:00
Simon Hausmann
254df328d0 Add support for images (resources) in models
This also allows replacing the emojis (not working due to lack of fallback) with images
2020-08-04 16:09:33 +02:00
Olivier Goffart
283387bc44 Add the self and parent implicit id 2020-08-04 15:58:40 +02:00
Simon Hausmann
ee3765e115 Print out the type we failed to convert to rust if it happens 2020-08-04 15:10:58 +02:00
Simon Hausmann
7277d15394 Provide a better error message when failing to convert a type to C++ 2020-08-04 15:04:18 +02:00
Simon Hausmann
2d255380c7 Don't crash when trying to report internal errors 2020-08-04 15:01:42 +02:00
Simon Hausmann
71a1daaf5a Don't crash if we can't find the unicode replacement character
Fall back to a question mark :-)
2020-08-04 14:28:45 +02:00
Olivier Goffart
8c793c81e9 Implement some transition between pages 2020-08-04 14:13:22 +02:00
Olivier Goffart
52cf481dc4 Fix states in repeated elements
This create reference to new property that needs to be adjusted
2020-08-04 14:02:18 +02:00
Olivier Goffart
894d44e3ac Correctly print syntax errors in the viewer
(instead of panicking because of invalid synstax_node invariant)
2020-08-04 12:59:49 +02:00
Olivier Goffart
2d04e47230 Remove stray dbg 2020-08-04 12:59:49 +02:00
Simon Hausmann
41671e3efb Represent the window scale factor conversions in the IR
That means less code in the generators and easier to extend in the
future with more built-in functions.
2020-08-04 12:49:37 +02:00
Olivier Goffart
1d0eacc87f Fix wasm build 2020-08-04 12:22:40 +02:00
Olivier Goffart
d158690a88 Add some buttons for the printer demo 2020-08-04 12:19:32 +02:00
Olivier Goffart
01a626cf49 Fix panic when the glyph do not exist in the font
This happen with emoji.
Show a replacement character (�) instead
2020-08-04 12:18:30 +02:00