Commit graph

233 commits

Author SHA1 Message Date
Olivier Goffart
47be71e16d Introduce layout stretching 2020-10-26 16:40:35 +01:00
Olivier Goffart
20cfb65e53 Bump version 2020-10-22 08:41:45 +02:00
Olivier Goffart
9f08492258 Make sure that the ListView is not scrolled when there is enough room for all contents
Fixes #93
2020-10-21 09:47:33 +02:00
Simon Hausmann
a98da9ecc9 Draw rounded rectangles with anti-aliasing
Draw rounded rectangles using a distance function. This removes the need
to use lyon to tesselate the rounded corners and as a bonus it gives
anti-aliased borders.
2020-10-21 09:35:35 +02:00
Simon Hausmann
ccb57114ce Clean up cursor rectangle handling
Generalize this to be called a normalized rectangle and create it by hand.
2020-10-21 08:15:16 +02:00
Olivier Goffart
e46e0b683c Fix the size of the native CheckBox 2020-10-20 19:00:40 +02:00
Simon Hausmann
1887b37af7 Remove premultiply_alpha from ARGBColor again
It's not safe to use with ARGBColor<u8> because of overflows, so instead let's
use it in the place where we need it and where the precision is given.
2020-10-19 18:45:33 +02:00
Simon Hausmann
6dd08b2109 Fix color blending when using the alpha channel
Given choice of ONE_MINUS_SRC_ALPHA blending function, we assume not
only that textures are pre-multiplied with their alpha (see commit
bf396ad578), the same applies also to
flat colors.

This fixes blending such as this:

    App := Window {
        Text {
            text: "Hello World";
        }
        Rectangle {
            color: #ff335588;
            width: 100%;
            height: 100%;
        }
    }
2020-10-19 17:21:03 +02:00
Olivier Goffart
2f9bc39010 Qt style: use a shared array everywhere 2020-10-19 11:52:03 +02:00
Olivier Goffart
b60567d7f2 Qt style: Use an QImage that is backed by a SharedArray
This way we have one copy less of the data
2020-10-19 11:35:57 +02:00
Olivier Goffart
7984e45a1f Fix ListView snapping to the bottom instead of the top
When there are not enough elements to fill the viewport
2020-10-16 11:21:59 +02:00
Olivier Goffart
e4e601de83 Draw the frame properly around the native scrollview 2020-10-16 10:45:17 +02:00
Simon Hausmann
93df708d87 Fix clipping in the wasm demos
Enable the stencil buffer on the WebGL context attributes.
2020-10-15 07:42:33 +02:00
Simon Hausmann
f43118cc89 Remove obsolete comment 2020-10-15 07:31:57 +02:00
Simon Hausmann
41d3fe940a Use a released version of glow 2020-10-15 07:29:15 +02:00
Olivier Goffart
d57ad389e0 Default to the native style in the viewer if it is available 2020-10-14 14:51:47 +02:00
Olivier Goffart
e48f0b7621 Add a current item to the StandardListView 2020-10-14 14:32:18 +02:00
Olivier Goffart
478bae93e1 Fix native scroolbar looking like sliders :-/ 2020-10-13 14:37:48 +02:00
Olivier Goffart
914ec61063 Revert "Temporarily disable fetching URL on wasm"
This reverts commit 49d75e0422.
2020-10-13 11:31:18 +02:00
Olivier Goffart
49d75e0422 Temporarily disable fetching URL on wasm
We cannot depends on an unreleased version of glow for publishing
2020-10-13 10:31:34 +02:00
Olivier Goffart
5a78776170 Add a version in Cargo.toml to be sure that the crate can be published 2020-10-13 10:19:14 +02:00
Olivier Goffart
4d4aa81007 Revert the commit than pins aho-corasick version
This reverts commit 0c8a31211e.

aho-corasick 0.7.14
2020-10-13 07:57:02 +02:00
Olivier Goffart
1138c9dbed Normalize the spelling of SixtyFPS 2020-10-13 07:48:55 +02:00
Simon Hausmann
2f7839e326 Remove unused BuiltinItem derivation
It's not needed :-)
2020-10-12 18:21:36 +02:00
Simon Hausmann
e1fdef73b1 Remove unused data structure
Added accidentally in parent commit
2020-10-12 18:20:25 +02:00
Simon Hausmann
805ba494ba Fix native padding calculation for NativeLineEdit
Similar to the parent commit, don't calculate the native_padding_* as a side-effect of calling
layout_info(), but calculate it property through a binding.
2020-10-12 16:49:44 +02:00
Simon Hausmann
fa982b9380 Fix calculation of native group box padding
Setting the value of the native_padding_{left, right, top, bottom}
properties *during* the layout_info() call is too late, as the calling
compute_layout implementation has already queried for those properties.

Instead, this patch moves the padding calculation into a shared property
binding that's queried from bindings to the individual native_padding_*
properties and layout_info() just uses the properties, too.
2020-10-12 16:49:44 +02:00
Simon Hausmann
a37d42fa0e Add an init function to the Item vtable
This will be called by the run-time and will allow items to set up
bindings that rely on internals that should not be exposed to the
compiler/runtime.
2020-10-12 16:49:44 +02:00
Simon Hausmann
0c8a31211e Work around build failure on macOS
I keep running into https://github.com/BurntSushi/aho-corasick/issues/64
on macOS, so pin aho-corasick to 0.7.4.
2020-10-12 14:46:21 +02:00
Olivier Goffart
cae0503fbb Update outdated dependencies 2020-10-12 10:29:07 +02:00
Olivier Goffart
9a909142a8 Disable wayland dependency by default 2020-10-10 16:10:22 +02:00
Olivier Goffart
9dbe1f874f One need image 0.23.10 to use image::ImageBuffer::as_raw 2020-10-09 12:08:18 +02:00
Simon Hausmann
51f9fc0e61 Refresh the window when loading of an HTML image completed 2020-10-09 10:44:15 +02:00
Simon Hausmann
f4b6eea646 Implement the rest of the dynamic image loading for the online editor
This works except that there's a mechanism missing for refreshing the
canvas when the image was loaded.
2020-10-09 10:10:48 +02:00
Simon Hausmann
785f23f01a Make the tex__image_2d call work
* Set cross origin for the image to "anonymous" to ask the server for permission
* Pass RGBA as internal format
2020-10-09 09:57:45 +02:00
Olivier Goffart
6c9f0691aa WIP: Attempt to get image loading in wasm
Not working
2020-10-09 09:57:45 +02:00
Simon Hausmann
0f07684fcf Clean up GLFrame::render_primitive
Move the main match out into a separate helper function in GLFrame and
keep render_primitive to just be the loop. This will also make it easier
to implement the dynamic primitives later.
2020-10-09 09:56:32 +02:00
Olivier Goffart
3bdd71b36f Start working on the Native ListView
Currently only the interpret part
2020-10-08 15:51:33 +02:00
Simon Hausmann
4ff3bf4ebf Fix crash with native style and large widgets
The native style typically allocates a texture for its surface, and if that
exceeds the size of the texture atlas, then we need to adjust instead
of crash.
2020-10-05 12:52:04 +02:00
Olivier Goffart
57ccd26393 Update winit 2020-10-03 14:55:25 +02:00
Simon Hausmann
3c7e1e414b Fix native button size with new gridlayout
Make the button size fixed, like in the ugly style.
2020-10-02 15:55:56 +02:00
Simon Hausmann
97f8dd0d1b Use a tight bounding box around rasterized glyphs
Fixes #8
2020-10-01 13:27:14 +02:00
Simon Hausmann
fdebd8427d Improve texture atlas handling
Avoid the manual padding of images in the texture atlas. This is a
CPU-side expensive operation and we can avoid doing that by instead
adjusting the texture coordinates to map to the center of the texels.
This is also described nicely in
https://docs.microsoft.com/en-us/windows/win32/direct3d9/directly-mapping-texels-to-pixels
2020-10-01 09:51:18 +02:00
Simon Hausmann
88b94a26ea Add support for clip rectangles in the GL rendering backend 2020-09-29 11:42:02 +02:00
Olivier Goffart
6662e1ff00 Proper Scrollbar on the native style 2020-09-28 18:13:13 +02:00
Simon Hausmann
f05d3c58e2 Revert "Fix crash on start-up of rusttest2"
This reverts commit 7e5b6843a4. Lyon
0.16.2 contains the fix.
2020-09-28 13:30:17 +02:00
Olivier Goffart
6dd0d178a0 Rename ScrollArea to ScrollView 2020-09-28 10:52:29 +02:00
Simon Hausmann
b7299af5d9 Attempt to make the focus ring of line edits also visible for the native style
On macOS that's not visible though due to the margins not being included in the rendering somehow.
2020-09-25 11:23:43 +02:00
Simon Hausmann
e5dfb3a4c0 Implement basic focus handling
Similar to the mouse_grabber, we use a VisitChildrenResult field to
track the focus item within a component. Unlike the mouse grabber
however, it is set/cleared using dedicated focus events.

The key event now routes the key event directly to the focus item.

The focus can be requested via set_focus_item on a window, which the
TextItem does.
2020-09-25 10:43:47 +02:00
Simon Hausmann
2b76e9277a Prepare for allowing an item mouse handler to request focus
In the future the TextInput will request focus on mouse click,for
example.

Pass the outer-most component through to ItemVTable's input_event.

For the purpose of disambiguating this component from any nested
component instantiated by a repeater or so, it's called the
app_component.

The ComponentVTable takes a reference to a ComponentRefPin instead of a
ComponentRefPin by value, as the vtable macro gets confused otherwise
and thinks it's a self argument.
2020-09-25 10:06:15 +02:00