These are chat archives for AvaloniaUI/Avalonia

30th
Jan 2016
Darnell Williams
@Seeker1437
Jan 30 2016 08:00
@abdelkarim the best method I have seen for this that will ensure it is working as closely as possible is having to redesign an editor in C++ (it's the only language where you can do a fully custom editor for VS)
WOuldn't it be nice though if skia is worked on more, it could just use libperspex and handle it's rendering
Steven Kirk
@grokys
Jan 30 2016 11:57
We should try to do a new alpha once the omnixaml changes are finished. There's not been that much user-visible that's changed but there have been a lot of infrastructure improvements.
Steven Kirk
@grokys
Jan 30 2016 12:20
@KvanTTT just looking at the PolylineGeometry you comitted. All of the other geometry typed defer to the platform implementation for Bounds but PolylineGeometry calculates it itself. Is there a reason for this?
Ivan Kochurkin
@KvanTTT
Jan 30 2016 12:23
Yes, public override Rect Bounds => PlatformImpl.Bounds; is not working for Direct2D render when Shape does not contain Fill. In this case Bounds calculated not properly.
LineGeometry implemented by the same way.
Steven Kirk
@grokys
Jan 30 2016 12:26
oh really? strange! any idea why this is?
Ivan Kochurkin
@KvanTTT
Jan 30 2016 12:30
to be honest I dont know. I think @kekekeks understand it better.
Possible I found potential bug: If Polyline has only one point, bounds will be calculated not properly https://github.com/Perspex/Perspex/blob/e60fef22c6cf7292d0a8878af36b710ed03826e7/src/Perspex.SceneGraph/Media/PolylineGeometry.cs#L42 xMax an yMax coordinates will not be inited.
Steven Kirk
@grokys
Jan 30 2016 12:40
ah yes
also it recalulates every time, whereas if it defers the the platform implementation, i assume that value will be cached
i will investigate the problem with D2D
Ivan Kochurkin
@KvanTTT
Jan 30 2016 12:46
Does Slider component available in Perspex?
Steven Kirk
@grokys
Jan 30 2016 12:51
not yet, no
another problem with Polyline/Polygon is that it creates a new geometry each time DefiningGeometry is called
i can fix it and make it cache if you like
Ivan Kochurkin
@KvanTTT
Jan 30 2016 13:09
Yes, caching is good
Steven Kirk
@grokys
Jan 30 2016 13:10
ok, done
Ivan Kochurkin
@KvanTTT
Jan 30 2016 13:15
good!
Steven Kirk
@grokys
Jan 30 2016 13:39
@KvanTTT https://github.com/Perspex/Perspex/blob/master/src/Perspex.SceneGraph/Media/PolylineGeometry.cs#L21 - that parameter should be called isClosed, not isFilled, right?
This message was deleted
oh, actually, it's both isClosed and isFilled...
BeginFigure takes isFilled and EndFigure takes isClosed
Ivan Kochurkin
@KvanTTT
Jan 30 2016 13:49
Polyline should not be Filled and should not be Closed. That is isClosed == isFilled.
Steven Kirk
@grokys
Jan 30 2016 15:04
yeah, sorry, i was just confused by the fact it's named isFilled when it actually means isClosedAndFilled
but that's not a problem
Steven Kirk
@grokys
Jan 30 2016 15:11
ok, regarding the problem with D2D's reported bounds - calling GetWidenedBounds with a strokeWidth of 0 seems to report the correct bounds
Geometry.Bounds (in WPF) is equivalent to ID2D1Geometry::GetWidenedBounds(0.0f).
so it sounds like we should always use that method
Steven Kirk
@grokys
Jan 30 2016 15:21
updated the D2D backend to use GetWidenedBounds for Bounds and all seems to work fine, so removed the workarounds in Poly/LineGeometry.
Ivan Kochurkin
@KvanTTT
Jan 30 2016 15:23
Will you repair it or I should do it?
Steven Kirk
@grokys
Jan 30 2016 15:34
already done it :)
also just noticed that the Shape classes don't react to changes in their geometry, so implementing that too
Steven Kirk
@grokys
Jan 30 2016 15:53
ok, that's fixed too
Ivan Kochurkin
@KvanTTT
Jan 30 2016 16:01
:+1:
Steven Kirk
@grokys
Jan 30 2016 16:04
i've been looking into how WPF handles mouse transparency (Perspex/Perspex#201)
it seems that after the control renders itself with a DrawingContext for example, the geometry information created by the DrawingContext is stored in the control
and that is used for hit-testing
that would be the ideal way to do it, but it would involve a radical change to our rendering backends to generate geometry rather than draw directly
(though it something like that would be useful for threaded rendering anyway)
Nikita Tsukanov
@kekekeks
Jan 30 2016 16:24

that would be the ideal way to do it, but it would involve a radical change to our rendering backends to generate geometry rather than draw directly

We just need some proxy backend that records drawing commands and passes them to actual renderer

Bitmap rendering might be tricky through
Since we need to generate snapshots of RenderTargetBitmap state
Or state that RenderTargetBitmap instance shouldn't be used more than once per frame
Steven Kirk
@grokys
Jan 30 2016 16:29
yeah, it's something that would be nice, but a lot of work
in the meantime, we could just allow each control to override a HitTestCore method and do its own hit testing
it would only be needed in a handful of controls
Ivan Kochurkin
@KvanTTT
Jan 30 2016 22:22
Handlers are working in designer (pointerPress). It's really cool :)