mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Add inset CSS clip-path support
This commit is contained in:
34
apps/app/ui-tests-app/css/clip-path-inset.xml
Normal file
34
apps/app/ui-tests-app/css/clip-path-inset.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<Page>
|
||||
<GridLayout rows="*,*,*,*,*" columns="*,*" automationText="clipPath">
|
||||
<StackLayout col="0" colSpan="2" row="0" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button width="100" height="100" text="no clip-path" style="background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;" />
|
||||
</StackLayout>
|
||||
|
||||
<StackLayout col="0" row="1" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button width="100" height="100" text="inset(10)" style="clip-path: inset(10); background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;" />
|
||||
</StackLayout>
|
||||
<StackLayout col="0" row="2" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button width="100" height="100" text="inset(10 20)" style="clip-path: inset(10 20); background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;" />
|
||||
</StackLayout>
|
||||
<StackLayout col="0" row="3" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button width="100" height="100" text="inset(10 20 30)" style="clip-path: inset(10 20 30); background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;" />
|
||||
</StackLayout>
|
||||
<StackLayout col="0" row="4" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button width="100" height="100" text="inset(10 20 30 40)" style="clip-path: inset(10 20 30 40); background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;" />
|
||||
</StackLayout>
|
||||
|
||||
<StackLayout col="1" row="1" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button width="100" height="100" text="inset(10%)" style="clip-path: inset(10%); background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;" />
|
||||
</StackLayout>
|
||||
<StackLayout col="1" row="2" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button width="100" height="100" text="inset(10% 20%)" style="clip-path: inset(10% 20%); background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;" />
|
||||
</StackLayout>
|
||||
<StackLayout col="1" row="3" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button width="100" height="100" text="inset(10% 20% 30%)" style="clip-path: inset(10% 20% 30%); background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;" />
|
||||
</StackLayout>
|
||||
<StackLayout col="1" row="4" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button width="100" height="100" text="inset(10% 20% 30% 40%)" style="clip-path: inset(10% 20% 30% 40%); background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;" />
|
||||
</StackLayout>
|
||||
|
||||
</GridLayout>
|
||||
</Page>
|
||||
@@ -1,9 +1,25 @@
|
||||
<Page>
|
||||
<GridLayout rows="*,*,*,*,*" automationText="clipPath">
|
||||
<Button text="circle" style="background-color: red; border-width:2; border-color: blue; clip-path: circle(100% at 50% 50%);"/>
|
||||
<Button text="ellipse" style="background-color: orange; border-width:2; border-color: green; clip-path: ellipse(50% 50% at 50% 50%);" row="1" />
|
||||
<Button text="rect" style="background-color: red; border-width:2; border-color: blue; clip-path: rect(0, 0, 100%, 100%);" row="2" />
|
||||
<Button text="polygon" style="background-color: magenta; border-width:2; border-color: red; clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%);" row="3" />
|
||||
<Button text="image polygon" style="background-image: url('https://media-cdn.tripadvisor.com/media/photo-s/03/9b/2f/ce/maldives.jpg'); border-width:2; border-color: red; clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);" row="4" />
|
||||
<GridLayout columns="*,*" rows="*,*,*,*">
|
||||
<StackLayout col="0" colSpan="2" row="0" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button text="no clip-path" width="100" height="100" style="background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;"/>
|
||||
</StackLayout>
|
||||
<StackLayout col="0" row="1" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button text="rect" width="100" height="100" style="clip-path: rect(10% 90 90% 10); background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;"/>
|
||||
</StackLayout>
|
||||
<StackLayout col="1" row="1" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button text="inset" width="100" height="100" style="clip-path: inset(15%); background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;"/>
|
||||
</StackLayout>
|
||||
<StackLayout col="0" row="2" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button text="circle" width="100" height="100" style="clip-path: circle(80% at 55% 40%); background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;"/>
|
||||
</StackLayout>
|
||||
<StackLayout col="1" row="2" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button text="ellipse" width="100" height="100" style=" clip-path: ellipse(45% 25% at 45% 55%); background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;"/>
|
||||
</StackLayout>
|
||||
<StackLayout col="0" row="3" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button text="polygon" width="100" height="100" style=" clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%);background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;"/>
|
||||
</StackLayout>
|
||||
<StackLayout col="1" row="3" width="100" height="100" style.backgroundColor="magenta">
|
||||
<Button text="image polygon" width="100" height="100" style=" clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);background-image: url('~/ui-tests-app/css/inset-test.png'); background-size: 100% 100%; background-repeat: no-repeat;"/>
|
||||
</StackLayout>
|
||||
</GridLayout>
|
||||
</Page>
|
||||
BIN
apps/app/ui-tests-app/css/inset-test.png
Normal file
BIN
apps/app/ui-tests-app/css/inset-test.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 556 B |
@@ -22,6 +22,7 @@ export function pageLoaded(args: EventData) {
|
||||
examples.set("switch", "css/views");
|
||||
examples.set("zindex", "css/zindex");
|
||||
examples.set("clipPath", "css/clip-path");
|
||||
examples.set("clipPathInset", "css/clip-path-inset");
|
||||
examples.set("padding", "css/padding");
|
||||
examples.set("label-background-image", "css/label-background-image");
|
||||
examples.set("transform-decoration-color", "css/transform-decoration-color");
|
||||
|
||||
Reference in New Issue
Block a user