-
Notifications
You must be signed in to change notification settings - Fork 541
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
added handler for column width in pixels #1746
Conversation
At some point we stopped requiring a type on Column, the .NET Renderer is probably out of date there. I think int makes sense for pixel unit, not sure where fraction of a pixel applies? |
We need to make sure that we're handling parsing of the units in the same way on all renderers. @paulcam206 noticed that also and is looking at fixing it. Fractional pixels can make sense since we're using logical pixels, but the width is exposed as an int in the shared model. In terms of functionality, fractional pixels don't really make a that much of a difference (until we add transforms and scales then could really affect the widths). My main concern here is consistency in how we parse the value having 23.5px be valid in one renderer but not in others will make for a bad sharing experience. |
I have a change in #1750 that deals with fractional pixels. FWIW, the visualizer supports (or at least allows) fractional pixels. |
So the consensus is we allow "23.5px" and also render exactly 23.5px right? |
Well, as @khouzam noted, the shared model exposes the width as an |
But since the TypeScript visualizer is allowing fractional pixels, we should at least allow it in other renderers right? So that a card is not rendered differently in different renderers? |
the way I've addressed it in #1750 is that the parser will accept fractional values, but still only exposes integral values through the object model. let's have a chat later about what to do. one thing I don't know is whether the typescript visualizer is actually using fractional units, or just snapping to the nearest integer. |
https://github.com/Microsoft/AdaptiveCards/blob/master/source/nodejs/adaptivecards/src/card-elements.ts#L101 |
I think this lines up with what |
I just added final modifications so that it aligns with the TypeScript renderer: allow fractional values for pixel and truncates it to use only its integral part. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if double unit makes sense for pixel (e.g.,
50.3px
) and also for weighted proportion (already in use)For testing, you can use the payload below. I noticed the payload provided in the epic does not have
"type": "Column"
anywhere and the .NET renderer throws an error for it. Is that something missing from the .NET renderer?