mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
fix(ios): shadow position after translate transform (#10413)
This commit is contained in:

committed by
GitHub

parent
ee87b52ac3
commit
c78ea79f0f
@ -155,23 +155,15 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
|
||||
private layoutOuterShadows(): void {
|
||||
const nativeView: NativeScriptUIView = <NativeScriptUIView>this.nativeViewProtected;
|
||||
if (nativeView) {
|
||||
const frame = nativeView.frame;
|
||||
const needsUpdate: boolean = nativeView.outerShadowContainerLayer != null;
|
||||
|
||||
if (needsUpdate) {
|
||||
if (nativeView?.outerShadowContainerLayer) {
|
||||
CATransaction.setDisableActions(true);
|
||||
|
||||
if (nativeView.outerShadowContainerLayer) {
|
||||
const { x: originX, y: originY }: CGPoint = nativeView.outerShadowContainerLayer.anchorPoint;
|
||||
nativeView.outerShadowContainerLayer.bounds = nativeView.bounds;
|
||||
nativeView.outerShadowContainerLayer.position = CGPointMake(frame.origin.x + frame.size.width * originX, frame.origin.y + frame.size.height * originY);
|
||||
}
|
||||
nativeView.outerShadowContainerLayer.position = nativeView.center;
|
||||
|
||||
CATransaction.setDisableActions(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public setMeasuredDimension(measuredWidth: number, measuredHeight: number): void {
|
||||
super.setMeasuredDimension(measuredWidth, measuredHeight);
|
||||
|
@ -1091,7 +1091,6 @@ function drawBoxShadow(view: View): void {
|
||||
}
|
||||
|
||||
const bounds = nativeView.bounds;
|
||||
const viewFrame = nativeView.frame;
|
||||
const boxShadow: BoxShadow = background.getBoxShadow();
|
||||
|
||||
// Initialize outer shadows
|
||||
@ -1127,10 +1126,7 @@ function drawBoxShadow(view: View): void {
|
||||
|
||||
outerShadowContainerLayer.bounds = bounds;
|
||||
outerShadowContainerLayer.anchorPoint = layer.anchorPoint;
|
||||
|
||||
// Since shadow uses superlayer's coordinate system, we have to be more specific about shadow layer position
|
||||
const { x: originX, y: originY }: CGPoint = outerShadowContainerLayer.anchorPoint;
|
||||
outerShadowContainerLayer.position = CGPointMake(viewFrame.origin.x + viewFrame.size.width * originX, viewFrame.origin.y + viewFrame.size.height * originY);
|
||||
outerShadowContainerLayer.position = nativeView.center;
|
||||
|
||||
// Inherit view visibility values
|
||||
outerShadowContainerLayer.opacity = layer.opacity;
|
||||
|
Reference in New Issue
Block a user