mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Always set clipToBounds for images, list-view and scroll-view
This commit is contained in:
@ -1,22 +1,22 @@
|
|||||||
<Page>
|
<Page>
|
||||||
<GridLayout rows="*,*,*,*,*,*" columns="*,*,*,">
|
<GridLayout rows="*,*,*,*,*,*" columns="*,*,*,">
|
||||||
<TextView id="s0" row="0" col="0" textWrap="true" text="border-width: 5;"/>
|
<TextView id="s0" row="0" col="0" textWrap="true" autocorrect="false" text="border-width: 5;"/>
|
||||||
<TextView id="s1" row="0" col="1" textWrap="true" text="border-width: 5; border-color: red;"/>
|
<TextView id="s1" row="0" col="1" textWrap="true" autocorrect="false" text="border-width: 5; border-color: red;"/>
|
||||||
<TextView id="s2" row="0" col="2" textWrap="true" text="border-width: 5; border-color: red red red green;"/>
|
<TextView id="s2" row="0" col="2" textWrap="true" autocorrect="false" text="border-width: 5; border-color: red red red green;"/>
|
||||||
<TextView id="s3" row="1" col="0" textWrap="true" text="border-width: 5; border-color: red; border-radius: 5;"/>
|
<TextView id="s3" row="1" col="0" textWrap="true" autocorrect="false" text="border-width: 5; border-color: red; border-radius: 5;"/>
|
||||||
<TextView id="s4" row="1" col="1" textWrap="true" text="border-width: 5; border-color: red; border-radius: 50;"/>
|
<TextView id="s4" row="1" col="1" textWrap="true" autocorrect="false" text="border-width: 5; border-color: red; border-radius: 50;"/>
|
||||||
<TextView id="s5" row="1" col="2" textWrap="true" text="border-width: 5 10 15 20; border-color: green;"/>
|
<TextView id="s5" row="1" col="2" textWrap="true" autocorrect="false" text="border-width: 5 10 15 20; border-color: green;"/>
|
||||||
<TextView id="s6" row="2" col="0" textWrap="true" text="border-width: 5; border-color: red green blue yellow;"/>
|
<TextView id="s6" row="2" col="0" textWrap="true" autocorrect="false" text="border-width: 5; border-color: red green blue yellow;"/>
|
||||||
<TextView id="s7" row="2" col="1" textWrap="true" text="border-width: 5 10 15 20; border-color: red green blue yellow;"/>
|
<TextView id="s7" row="2" col="1" textWrap="true" autocorrect="false" text="border-width: 5 10 15 20; border-color: red green blue yellow;"/>
|
||||||
<TextView id="s8" row="2" col="2" textWrap="true" text="border-width: 5 10; border-color: red green;"/>
|
<TextView id="s8" row="2" col="2" textWrap="true" autocorrect="false" text="border-width: 5 10; border-color: red green;"/>
|
||||||
<TextView id="s9" row="3" col="0" textWrap="true" text="border-width: 15 10 5; border-color: red green blue;"/>
|
<TextView id="s9" row="3" col="0" textWrap="true" autocorrect="false" text="border-width: 15 10 5; border-color: red green blue;"/>
|
||||||
<TextView id="s10" row="3" col="1" textWrap="true" text="border-width: 5 0; border-color: black;"/>
|
<TextView id="s10" row="3" col="1" textWrap="true" autocorrect="false" text="border-width: 5 0; border-color: black;"/>
|
||||||
<TextView id="s11" row="3" col="2" textWrap="true" text="background-color: magenta;"/>
|
<TextView id="s11" row="3" col="2" textWrap="true" autocorrect="false" text="background-color: magenta;"/>
|
||||||
<TextView id="s12" row="4" col="0" textWrap="true" text="border-width: 5 10 15 20; border-color: red green blue yellow; border-radius: 5 10 15 20;"/>
|
<TextView id="s12" row="4" col="0" textWrap="true" autocorrect="false" text="border-width: 5 10 15 20; border-color: red green blue yellow; border-radius: 5 10 15 20;"/>
|
||||||
<TextView id="s13" row="4" col="1" textWrap="true" text="border-width: 5 10 15 20; border-color: red green blue yellow; border-radius: 5;"/>
|
<TextView id="s13" row="4" col="1" textWrap="true" autocorrect="false" text="border-width: 5 10 15 20; border-color: red green blue yellow; border-radius: 5;"/>
|
||||||
<TextView id="s14" row="4" col="2" textWrap="true" text="border-width: 5 10 15 20; border-color: red green blue yellow; background-color: magenta;"/>
|
<TextView id="s14" row="4" col="2" textWrap="true" autocorrect="false" text="border-width: 5 10 15 20; border-color: red green blue yellow; background-color: magenta;"/>
|
||||||
<TextView id="s15" row="5" col="0" textWrap="true" text="border-width: 5 10 15 20; border-color: red green blue yellow; background-image: url('~/ui-tests-app/pages/test2.png');"/>
|
<TextView id="s15" row="5" col="0" textWrap="true" autocorrect="false" text="border-width: 5 10 15 20; border-color: red green blue yellow; background-image: url('~/ui-tests-app/pages/test2.png');"/>
|
||||||
<TextView id="s16" row="5" col="1" textWrap="true" text="border-width: 5; border-color: red; padding: 5;"/>
|
<TextView id="s16" row="5" col="1" textWrap="true" autocorrect="false" text="border-width: 5; border-color: red; padding: 5;"/>
|
||||||
<TextView id="s17" row="5" col="2" textWrap="true" text="border-width: 5 6 7 8; border-color: red green blue yellow; padding: 5 6 7 8;"/>
|
<TextView id="s17" row="5" col="2" textWrap="true" autocorrect="false" text="border-width: 5 6 7 8; border-color: red green blue yellow; padding: 5 6 7 8;"/>
|
||||||
</GridLayout>
|
</GridLayout>
|
||||||
</Page>
|
</Page>
|
@ -16,8 +16,8 @@ export class Image extends ImageBase {
|
|||||||
//TODO: Think of unified way of setting all the default values.
|
//TODO: Think of unified way of setting all the default values.
|
||||||
this._ios = UIImageView.new();
|
this._ios = UIImageView.new();
|
||||||
this._ios.contentMode = UIViewContentMode.ScaleAspectFit;
|
this._ios.contentMode = UIViewContentMode.ScaleAspectFit;
|
||||||
this._ios.clipsToBounds = true;
|
|
||||||
this._ios.userInteractionEnabled = true;
|
this._ios.userInteractionEnabled = true;
|
||||||
|
this._setNativeClipToBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
get ios(): UIImageView {
|
get ios(): UIImageView {
|
||||||
@ -45,6 +45,11 @@ export class Image extends ImageBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_setNativeClipToBounds() {
|
||||||
|
// Always set clipsToBounds for images
|
||||||
|
this._ios.clipsToBounds = true;
|
||||||
|
}
|
||||||
|
|
||||||
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void {
|
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void {
|
||||||
// We don't call super because we measure native view with specific size.
|
// We don't call super because we measure native view with specific size.
|
||||||
let width = layout.getMeasureSpecSize(widthMeasureSpec);
|
let width = layout.getMeasureSpecSize(widthMeasureSpec);
|
||||||
|
@ -217,6 +217,12 @@ export class ListView extends ListViewBase {
|
|||||||
this._delegate = UITableViewDelegateImpl.initWithOwner(new WeakRef(this));
|
this._delegate = UITableViewDelegateImpl.initWithOwner(new WeakRef(this));
|
||||||
this._heights = new Array<number>();
|
this._heights = new Array<number>();
|
||||||
this._map = new Map<ListViewCell, View>();
|
this._map = new Map<ListViewCell, View>();
|
||||||
|
this._setNativeClipToBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
_setNativeClipToBounds() {
|
||||||
|
// Always set clipsToBounds for list-view
|
||||||
|
this._ios.clipsToBounds = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public onLoaded() {
|
public onLoaded() {
|
||||||
|
@ -36,6 +36,12 @@ export class ScrollView extends ScrollViewBase {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.nativeView = UIScrollView.new();
|
this.nativeView = UIScrollView.new();
|
||||||
|
this._setNativeClipToBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
_setNativeClipToBounds() {
|
||||||
|
// Always set clipsToBounds for scroll-view
|
||||||
|
this.nativeView.clipsToBounds = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected attachNative() {
|
protected attachNative() {
|
||||||
|
Reference in New Issue
Block a user