mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Fix: java.lang.NumberFormatException when applying clip-path with percentage values
Resolves #3007
This commit is contained in:
11
apps/app/ui-tests-app/issues/issue-3007.css
Normal file
11
apps/app/ui-tests-app/issues/issue-3007.css
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
.container {
|
||||||
|
width: 200;
|
||||||
|
height: 200;
|
||||||
|
clip-path: polygon(50% 3%, 3% 100%, 100% 100%);
|
||||||
|
background-color: black;
|
||||||
|
}
|
||||||
|
.elementStyle {
|
||||||
|
width: 200;
|
||||||
|
height: 200;
|
||||||
|
clip-path: polygon(50% 3%, 3% 100%, 100% 100%);
|
||||||
|
}
|
10
apps/app/ui-tests-app/issues/issue-3007.xml
Normal file
10
apps/app/ui-tests-app/issues/issue-3007.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Page id="Page" xmlns="http://schemas.nativescript.org/tns.xsd">
|
||||||
|
<StackLayout id="StackLayout">
|
||||||
|
<Image id="Image" width="100" height="100" class="elementStyle" src="~/ui-tests-app/image-view/gravatar.png"/>
|
||||||
|
<Button id="Button" backgroundColor="blue" class="elementStyle" text="TAP" />
|
||||||
|
<Label id="Label" backgroundColor="red" class="elementStyle" text="sample label" textWrap="true"/>
|
||||||
|
<TextField id="TextField" backgroundColor="green" class="elementStyle" hint="" text="Sample textfield" />
|
||||||
|
<TextView id="TextView" class="elementStyle" text="Sample text view" backgroundColor="yellow" editable="true" />
|
||||||
|
<AbsoluteLayout id="AbsoluteLayout" class="container"/>
|
||||||
|
</StackLayout>
|
||||||
|
</Page>
|
@ -14,6 +14,7 @@ export function pageLoaded(args: EventData) {
|
|||||||
examples.set("2911", "issues/issue-2911");
|
examples.set("2911", "issues/issue-2911");
|
||||||
examples.set("2674", "issues/issue-2674");
|
examples.set("2674", "issues/issue-2674");
|
||||||
examples.set("2942", "issues/issue-2942");
|
examples.set("2942", "issues/issue-2942");
|
||||||
|
examples.set("3007", "issues/issue-3007");
|
||||||
|
|
||||||
let viewModel = new SubMianPageViewModel(wrapLayout, examples);
|
let viewModel = new SubMianPageViewModel(wrapLayout, examples);
|
||||||
page.bindingContext = viewModel;
|
page.bindingContext = viewModel;
|
||||||
|
@ -67,7 +67,7 @@ export module ad {
|
|||||||
_defaultBackgrounds.set(viewClass, nativeView.getBackground());
|
_defaultBackgrounds.set(viewClass, nativeView.getBackground());
|
||||||
}
|
}
|
||||||
|
|
||||||
backgroundDrawable = new org.nativescript.widgets.BorderDrawable(density);
|
backgroundDrawable = new org.nativescript.widgets.BorderDrawable(density, v.toString());
|
||||||
refreshBorderDrawable(v, <org.nativescript.widgets.BorderDrawable>backgroundDrawable);
|
refreshBorderDrawable(v, <org.nativescript.widgets.BorderDrawable>backgroundDrawable);
|
||||||
nativeView.setBackground(backgroundDrawable);
|
nativeView.setBackground(backgroundDrawable);
|
||||||
}
|
}
|
||||||
@ -116,6 +116,7 @@ export module ad {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function refreshBorderDrawable(view: view.View, borderDrawable: org.nativescript.widgets.BorderDrawable){
|
function refreshBorderDrawable(view: view.View, borderDrawable: org.nativescript.widgets.BorderDrawable){
|
||||||
|
//console.log(`>>> refreshBorderDrawable(${view})...`);
|
||||||
let background = <background.Background>view.style._getValue(style.backgroundInternalProperty);
|
let background = <background.Background>view.style._getValue(style.backgroundInternalProperty);
|
||||||
if (background){
|
if (background){
|
||||||
let backgroundPositionParsedCSSValues: native.Array<org.nativescript.widgets.CSSValue> = null;
|
let backgroundPositionParsedCSSValues: native.Array<org.nativescript.widgets.CSSValue> = null;
|
||||||
@ -154,6 +155,7 @@ function refreshBorderDrawable(view: view.View, borderDrawable: org.nativescript
|
|||||||
background.size,
|
background.size,
|
||||||
backgroundSizeParsedCSSValues
|
backgroundSizeParsedCSSValues
|
||||||
);
|
);
|
||||||
|
//console.log(`>>> ${borderDrawable.toDebugString()}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
export class BorderDrawable extends android.graphics.drawable.ColorDrawable {
|
export class BorderDrawable extends android.graphics.drawable.ColorDrawable {
|
||||||
constructor(density: number);
|
constructor(density: number);
|
||||||
|
constructor(density: number, id: string);
|
||||||
public refresh(
|
public refresh(
|
||||||
borderTopColor: number,
|
borderTopColor: number,
|
||||||
borderRightColor: number,
|
borderRightColor: number,
|
||||||
@ -104,6 +105,8 @@
|
|||||||
public hasUniformBorderWidth(): boolean;
|
public hasUniformBorderWidth(): boolean;
|
||||||
public hasUniformBorderRadius(): boolean;
|
public hasUniformBorderRadius(): boolean;
|
||||||
public hasUniformBorder(): boolean;
|
public hasUniformBorder(): boolean;
|
||||||
|
|
||||||
|
public toDebugString(): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CSSValue {
|
export class CSSValue {
|
||||||
|
Reference in New Issue
Block a user