(originX: number, originY: number)
| 455 | } |
| 456 | |
| 457 | public updateOriginPoint(originX: number, originY: number) { |
| 458 | const nativeView: NativeScriptUIView = <NativeScriptUIView>this.nativeViewProtected; |
| 459 | const newPoint = CGPointMake(originX, originY); |
| 460 | |
| 461 | // Disable CALayer animatable property changes |
| 462 | CATransaction.setDisableActions(true); |
| 463 | |
| 464 | nativeView.layer.anchorPoint = newPoint; |
| 465 | |
| 466 | // Bounds have to be recalculated after anchor point update |
| 467 | if (this._cachedFrame) { |
| 468 | const frame = this._cachedFrame; |
| 469 | |
| 470 | this._cachedFrame = null; |
| 471 | this._setNativeViewFrame(nativeView, frame); |
| 472 | } |
| 473 | |
| 474 | // Make sure new origin also applies to outer shadow layers |
| 475 | if (nativeView.outerShadowContainerLayer) { |
| 476 | // This is the new frame after view origin point update |
| 477 | const frame = nativeView.frame; |
| 478 | |
| 479 | nativeView.outerShadowContainerLayer.anchorPoint = newPoint; |
| 480 | nativeView.outerShadowContainerLayer.position = CGPointMake(frame.origin.x + frame.size.width * originX, frame.origin.y + frame.size.height * originY); |
| 481 | } |
| 482 | |
| 483 | CATransaction.setDisableActions(false); |
| 484 | } |
| 485 | |
| 486 | // By default we update the view's presentation layer when setting backgroundColor and opacity properties. |
| 487 | // This is done by calling CATransaction begin and commit methods. |
no test coverage detected