mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: format
This commit is contained in:
@@ -6,43 +6,75 @@ import { layout } from "../../utils/utils";
|
||||
@Deprecated
|
||||
@CSSType("Border")
|
||||
export class Border extends ContentView implements BorderDefinition {
|
||||
get cornerRadius(): number {
|
||||
if (typeof this.borderRadius === "number") {
|
||||
return <number>this.borderRadius;
|
||||
}
|
||||
get cornerRadius(): number {
|
||||
if (typeof this.borderRadius === "number") {
|
||||
return <number>this.borderRadius;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
set cornerRadius(value: number) {
|
||||
this.borderRadius = value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
set cornerRadius(value: number) {
|
||||
this.borderRadius = value;
|
||||
}
|
||||
|
||||
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void {
|
||||
const width = layout.getMeasureSpecSize(widthMeasureSpec);
|
||||
const widthMode = layout.getMeasureSpecMode(widthMeasureSpec);
|
||||
public onMeasure(
|
||||
widthMeasureSpec: number,
|
||||
heightMeasureSpec: number
|
||||
): void {
|
||||
const width = layout.getMeasureSpecSize(widthMeasureSpec);
|
||||
const widthMode = layout.getMeasureSpecMode(widthMeasureSpec);
|
||||
|
||||
const height = layout.getMeasureSpecSize(heightMeasureSpec);
|
||||
const heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
|
||||
const height = layout.getMeasureSpecSize(heightMeasureSpec);
|
||||
const heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
|
||||
|
||||
const horizontalBorderLength = this.effectiveBorderLeftWidth + this.effectiveBorderRightWidth;
|
||||
const verticalBorderLength = this.effectiveBorderTopWidth + this.effectiveBorderBottomWidth;
|
||||
const horizontalBorderLength =
|
||||
this.effectiveBorderLeftWidth + this.effectiveBorderRightWidth;
|
||||
const verticalBorderLength =
|
||||
this.effectiveBorderTopWidth + this.effectiveBorderBottomWidth;
|
||||
|
||||
const result = View.measureChild(this, this.layoutView,
|
||||
layout.makeMeasureSpec(width - horizontalBorderLength, widthMode),
|
||||
layout.makeMeasureSpec(height - verticalBorderLength, heightMode));
|
||||
const result = View.measureChild(
|
||||
this,
|
||||
this.layoutView,
|
||||
layout.makeMeasureSpec(width - horizontalBorderLength, widthMode),
|
||||
layout.makeMeasureSpec(height - verticalBorderLength, heightMode)
|
||||
);
|
||||
|
||||
const widthAndState = View.resolveSizeAndState(result.measuredWidth + horizontalBorderLength, width, widthMode, 0);
|
||||
const heightAndState = View.resolveSizeAndState(result.measuredHeight + verticalBorderLength, height, heightMode, 0);
|
||||
const widthAndState = View.resolveSizeAndState(
|
||||
result.measuredWidth + horizontalBorderLength,
|
||||
width,
|
||||
widthMode,
|
||||
0
|
||||
);
|
||||
const heightAndState = View.resolveSizeAndState(
|
||||
result.measuredHeight + verticalBorderLength,
|
||||
height,
|
||||
heightMode,
|
||||
0
|
||||
);
|
||||
|
||||
this.setMeasuredDimension(widthAndState, heightAndState);
|
||||
}
|
||||
this.setMeasuredDimension(widthAndState, heightAndState);
|
||||
}
|
||||
|
||||
public onLayout(left: number, top: number, right: number, bottom: number): void {
|
||||
let horizontalBorderLength = this.effectiveBorderLeftWidth + this.effectiveBorderRightWidth;
|
||||
let verticalBorderLength = this.effectiveBorderTopWidth + this.effectiveBorderBottomWidth;
|
||||
public onLayout(
|
||||
left: number,
|
||||
top: number,
|
||||
right: number,
|
||||
bottom: number
|
||||
): void {
|
||||
let horizontalBorderLength =
|
||||
this.effectiveBorderLeftWidth + this.effectiveBorderRightWidth;
|
||||
let verticalBorderLength =
|
||||
this.effectiveBorderTopWidth + this.effectiveBorderBottomWidth;
|
||||
|
||||
View.layoutChild(this, this.layoutView, this.effectiveBorderLeftWidth, this.effectiveBorderTopWidth, right - left - horizontalBorderLength, bottom - top - verticalBorderLength);
|
||||
}
|
||||
View.layoutChild(
|
||||
this,
|
||||
this.layoutView,
|
||||
this.effectiveBorderLeftWidth,
|
||||
this.effectiveBorderTopWidth,
|
||||
right - left - horizontalBorderLength,
|
||||
bottom - top - verticalBorderLength
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Border.prototype.recycleNativeView = "auto";
|
||||
|
||||
Reference in New Issue
Block a user