38 Commits

Author SHA1 Message Date
Adam Barth
ec0bccfb5d Optimize circular clips slightly
This patch avoids creating weak references on every paint call by caching the
Path object between paints.
2015-08-10 11:18:44 -07:00
Andrew Wilson
440a63a5bb Fix assert's related to image drawing. 2015-08-07 17:00:56 -07:00
Adam Barth
68565eb317 Use localToGlobal and globalToLocal in MimicOverlay
Also, make RenderStack support negative positions with clipping so that we can
expand objects that are partially offscreen.
2015-08-07 14:47:06 -07:00
Hans Muller
585f3f6297 Widget coordinate transforms: localToGlobal(), globalToLocal() 2015-08-07 14:20:57 -07:00
Adam Barth
b5e0b7c99a Unbreak text
Previously, no text was appearing because we weren't actually converting the
Dart objects into DOM.
2015-08-07 10:37:04 -07:00
Adam Barth
fb512aa604 Merge pull request #494 from abarth/integer_scrolling
RenderViewport should use integer device pixels
2015-08-07 09:52:14 -07:00
Adam Barth
4a70cfed5f Rename various text-related classes
- Inline -> Pargraph. This class is actually a box, not an inline. It's really
   a wrapper for RenderParagraph, so Paragraph is the normal name.

 - InlineBase -> RenderInline. The name we used in C++ for the base class of
   all inlines was RenderInline, which removes the ugly "Base" suffix.

 - InlineText -> RenderText. Aligns this name with C++.

 - InlineStyle -> RenderStyled. Matches the foregoing pattern.
2015-08-06 22:26:02 -07:00
Adam Barth
75da2a9f98 RenderViewport should use integer device pixels
When painting a scroll offset, RenderViewport should use integer device pixels
to prevent "shimmering" effects on images.

Fixes #486
2015-08-06 22:09:51 -07:00
Adam Barth
fd68741fb3 Add operator+ and operator- to EdgeDims
... and use them to improve the horizontal_scrolling example.
2015-08-06 09:41:22 -07:00
Adam Barth
870376dab1 Teach ScrollableBlock how to scroll horizontally
Now ScrollableBlock can combine a horizontally scrolling viewport with a
horizontal block.

Also rename ViewportScrollDirection to just ScrollDirection for less verbosity.
2015-08-05 18:10:03 -07:00
Adam Barth
6f2a3e406d Merge pull request #476 from abarth/horizontal_block
Teach Block how to layout horizontally
2015-08-05 17:36:31 -07:00
Adam Barth
f6c9ab8050 Teach Block how to layout horizontally
We'll need this for horizontally scrolling lists.
2015-08-05 17:20:13 -07:00
Adam Barth
2a4209553f Support horizontal scrolling in ScrollableViewport 2015-08-05 16:18:15 -07:00
Adam Barth
325bfcc739 Fix RenderViewport's hit testing
We were subtracting the scrollOffset when we were supposed to add it.
2015-08-04 15:54:51 -07:00
Matt Perry
78e18a5d18 When animating, use the same curve until it completes.
This ensures we don't run into discontinuities when reversing an
animation halfway through. I refactored AnimationValue to have knowledge
of the reverse curves and intervals.
2015-08-04 16:34:46 -04:00
James Robinson
56a4a8ad81 Add RenderToggleable base and use in Switch and Checkbox
This refactors Checkbox to own a RenderObject similar to how Switch was
refactored in https://github.com/domokit/sky_engine/pull/376 and
extracts common functionality for toggleable renderers into a base
class.  Switch and Checkbox's render objects derive from this base
class to add their own custom painting and theming logic.
2015-08-04 10:45:30 -07:00
James Robinson
53163f8b99 Teach event system about disposition and make 'consumed' disposition terminal
This introduces the notion of event disposition and allows event
targets (widgets and render objects) to consume events that should not
be processed further. This is needed by the Switch component in the
Drawer in the stocks example. The Switch is embedded in a DrawerItem.
The Switch handles the gesture tap event to toggle its state and should
handle pointer events to allow swiping and draw its own radial
reaction. The DrawerItem also handles gesture taps to allow toggling
the switch value when tapping anywhere on the drawer and to draw its
own ink splash. When tapping on the switch, both the switch's render
object and the DrawerItem's listener are in the event dispatch path.
The Switch needs to signal in some fashion that it consumed the event
so the DrawerItem does not also try to toggle the switch's state.
2015-08-03 17:31:30 -07:00
Adam Barth
2b0e4784d3 Fix TextAlign.right
We were applying the style to the RenderInline but we actually needed to apply
it to the RenderParagraph. The lineHeight property had the same problem.
2015-07-31 12:57:53 -07:00
Adam Barth
05d6d55171 Merge pull request #373 from abarth/fix_stack
RenderStack should handle top, right, bottom, left all being zero
2015-07-30 11:11:07 -07:00
Adam Barth
b86ad9b053 RenderStack should handle top, right, bottom, left all being zero
Previously, we didn't set the width of the child correctly when top and bottom
(or left and right) were both specified.

Fixes #275
2015-07-30 10:08:07 -07:00
Adam Barth
3c14e41b07 Sporadic crash from invalid touch event
When embedded by the view_manager, sometimes we receive pointerup or
pointercancel events without having received a cooresponding pointerdown event.
The underlying issue is that the view_manager doesn't capture on pointerdown
and instead performs a new hit test for every pointer event. We should fix that
in view_manager, but, in the meantime, this patch makes us not crash in this
scenario.

Fixes #339
2015-07-30 09:41:40 -07:00
Adam Barth
5d15bb5126 Move build() off microtasks
Rather than using a microtask to schedule component build functions, instead
use the scheduler. We now tread building just like layout and painting as a
visual update.
2015-07-28 14:05:21 -07:00
Hixie
144fe36e25 RenderConstrainedBox was ignoring its additional constraints for its intrinsic size logic when it had no child. 2015-07-23 09:06:34 -07:00
Hixie
a50b065197 Fix the crash when going to settings after showing the popup menu.
If your constraints are tight when you get laid out, you don't get a
relayout subtree root.

If you don't have a relayout subtree root, and you get marked dirty,
you go through layoutWithoutResize() rather than layout(), so we don't
get a parentUsesSize.

If you're not dirty and your constraints didn't change, layout() skips
your layout.

So then if your initial layout had parentUsesSize:true, and then you
got marked dirty directly, you would set your size with
parentCanUseSize=false, and then later if your parent tried to lay you
out then read your size, it would crash because your size wasn't set
up to allow you to get your size.

The fix is to actually remember the last setting of parentUsesSize,
even in the case of the constraints being tight and you later being
marked as needing layout directly.
2015-07-22 10:10:58 -07:00
Adam Barth
6b748e653e Fix more analyzer warnings 2015-07-21 13:59:18 -07:00
Adam Barth
53efc748e1 Merge pull request #191 from abarth/image_height_width
Separate width and height parameters for Image widgets
2015-07-21 13:54:56 -07:00
Adam Barth
012b915704 Separate width and height parameters for Image widgets
This change makes it easier to defined only the width or the height of an image
and let the other value be filled in from the image's intrinsic aspect ratio.

Fixes #175
2015-07-21 13:46:10 -07:00
Matt Perry
0fd3302ebe Renamed AnimatedType to AnimatedValue 2015-07-21 12:55:16 -07:00
Adam Barth
7af81f208a Fix typos in RenderImage
This function took innerConstraints as an argument but used constraints internally.
2015-07-20 20:04:03 -07:00
Collin Jackson
e90d0ec807 Merge remote-tracking branch 'upstream/master' into baseline5
Conflicts:
	sky/sdk/lib/rendering/flex.dart
2015-07-20 10:26:06 -07:00
Collin Jackson
8bf1f86a24 abarth feedback 2015-07-20 10:24:52 -07:00
Collin Jackson
4604021dd3 Support for non-alphabetic baselines 2015-07-17 17:06:08 -07:00
Collin Jackson
e3d5c2b25e Draw debug rects when flex overflows 2015-07-17 17:04:59 -07:00
Collin Jackson
62fc9d8515 Track overflow during flex layout 2015-07-17 16:13:15 -07:00
Collin Jackson
695a13583b Update example 2015-07-17 14:29:05 -07:00
Collin Jackson
07f9c95efc Fix comments 2015-07-17 12:49:37 -07:00
Collin Jackson
7a7110b2a0 Fix #57 Flex needs to understand baselines 2015-07-17 12:46:51 -07:00
Collin Jackson
633b65010c After running filter-branch, move root directory into sky/ 2015-07-16 11:54:25 -07:00