Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
I know that there is an API council request to change Modifier.drawLayer
to Modifier.graphicsLayer` thus dropping the "draw" prefix to the modifier. I think it might be reasonable to rename the following to match the naming of the fields within the layer API:
Introduce the following:
Modifier.drawOpacity -> Modifier.alpha
Modifier.scale,
Modifier.rotateX,
Modifier.rotateY,
Modifier.rotate (maybe rotateZ but maybe drop the Z to keep it simple?)
Modifier.translate
I think it is reasonable to have both Modifier.offset as well as translate with the documentation indicating that translate is more effective for animated use cases. The only concern I have is if we can somehow detect several of these modifiers in a chain would be able to effectively squash them into a single layer, (ex: Modifier.alpha(0.5f).scale(2f).rotate(45) etc.). What do you think?
ap...@google.com <ap...@google.com> #3
1) you forgot to mention:
Modifier.drawShadow -> Modifier.shadow
2) I think for scale we can both overloads like
Modifier.scale(scaleX: Float, scaleY: Float)
Modifier.scale(scale: Float) = scale(scale, scale)
3) can we do similar thing for rotation? in simple cases you only want to rotate x and y, right?
Modifier.rotation(rotationX: Float, rotationY: Float, rotationZ: Float)
Modifier.rotation(rotation: Float) = rotation(rotation, rotation, 0)
4) and please, lets not add Modifier.translate() just yet. I am ok with this being available as more low level api Modifier.drawLayer() where we have more options, but not something so easy discoverable. in the doc we agreed that it could be useful to keep it for some complex cases. I am strongly convinced we shoudn't have both Modifier.offsetPx() and Modifier.translation()
5) so the decision to rename to graphicLayer() is final? I have a cl which will be affected by that:https://android-review.googlesource.com/c/platform/frameworks/support/+/1496274 . Should I already use new name GraphicLayerScope there?
Modifier.drawShadow -> Modifier.shadow
2) I think for scale we can both overloads like
Modifier.scale(scaleX: Float, scaleY: Float)
Modifier.scale(scale: Float) = scale(scale, scale)
3) can we do similar thing for rotation? in simple cases you only want to rotate x and y, right?
Modifier.rotation(rotationX: Float, rotationY: Float, rotationZ: Float)
Modifier.rotation(rotation: Float) = rotation(rotation, rotation, 0)
4) and please, lets not add Modifier.translate() just yet. I am ok with this being available as more low level api Modifier.drawLayer() where we have more options, but not something so easy discoverable. in the doc we agreed that it could be useful to keep it for some complex cases. I am strongly convinced we shoudn't have both Modifier.offsetPx() and Modifier.translation()
5) so the decision to rename to graphicLayer() is final? I have a cl which will be affected by that:
Description
--Updated scale and rotation transformation APIs to consume a single Offset parameter to represent the pivot coordinate instead of separate float parameters for the x/y coordinates in DrawScope and DrawTransform
--Removed Rect.expandToInclude and Rect.join methods
--Updated Radius documentation to say oval in addition to elliptical
--Added documentation to indicate the public constructor for the inline Radius class is not to be called directly but instead Radius objects should be instantiated through their function constructors
--Removed RoundRect APIs to query topRight, bottomRight, bottomCenter, etc.
--Deprecated Rect.shift in favor of Rect.translate
--Removed RoundRect.grow and Rect.shrink APIs
--Renamed RoundRect.outerRect to Rect.boundingRect
--Removed RoundRect.middleRect/tallMiddleRect/wideMiddleRect and Rect.isStadium methods
--Renamed RoundRect.longestSide to RoundRect.maxDimension
--Renamed RoundRect.shortestSide to RoundRect.minDimension
--Changed RoundRect.center to be a property instead of a function
--Updated RoundRect constructor to consume Radius properties instead of individual parameters for x/y radius values
--Removed Size APIs that assumed it was a Rectangle with origin at 0,0 --Added a destructing API to Radius
--Migrated various RoundRect extension functions to be properties instead
--Rename Radius to CornerRadius
--Document behavior of negative radii