-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG ?] LinearGradientPaint vertical becomes horizontal for no apparent reason ? #648
Comments
The bug seem to be cause when the height is reduce to 0. container := BlElement new layout: BlLinearLayout vertical; position: 50 asPoint; constraintsDo: [ :c |
c vertical fitContent. c horizontal exact: 250 ]; yourself.
opened := true.
bgPaint := (BlLinearGradientPaint vertical from: Color green to: Color red).
openedAnimation := BlNumberTransition new from: 0; to: 150; duration: 1 second; onStepDo: [ :point |
collapsed height: 0 + point ].
closedAnimation := BlNumberTransition new from: 0; to: 150; duration: 1 second; onStepDo: [ :point |
collapsed height: 150 - point + 0.01 ].
openCollapsedBlock := [ opened
ifTrue: [
collapsed addAnimation: openedAnimation copy ]
ifFalse: [
collapsed addAnimation: closedAnimation copy ] ].
handle := BlTextElement new background: Color lightBlue; size: 250 @ 50; addEventHandlerOn: BlClickEvent do: [ :e | e consume. opened := opened not.
openCollapsedBlock value];
text: 'Click here' asRopedText;
yourself.
collapsed := BlElement new background: bgPaint ; size: 250 @ 150; border: (BlBorderBuilder new paint: Color red; width: 3; dashed; build); yourself.
container addChild: handle.
container addChild: collapsed.
container openInSpace
|
You can debug the original example by:
|
BlLinearLayout was probably never designed to be used that way, in animation (probably only in fixed size scenario) The size of the background is determined by the size of its BlElement, and updated One fix would be for BlLinearLayout to remember its direction, independently of the size of its element, to cover this use case. Another quick fix is to reset its direction when you reopen it like openCollapsedBlock := [ opened
ifTrue: [ bgPaint start: 0 @ 0; end: 0 @ 1. collapsed addAnimation: openedAnimation copy ]
ifFalse: [ collapsed addAnimation: closedAnimation copy ] ]. |
This issue is somehow related: #270 |
Hello,
I stumbled across something that looks like a bug to me :
I'm trying to prototype some kind of collapse widget with a small animation to show my element collapsing or not, for now I have the following snippet you can try :
The thing is when clicking a first time the element collapses as intended but when clicking again it finds its original size but the BlLinearGradientPaint became apparently horizontal.
Before :
After:
Enzo
The text was updated successfully, but these errors were encountered: