Skip to content

Commit 652df80

Browse files
committed
chore: lint
1 parent f7ca86a commit 652df80

File tree

1 file changed

+24
-38
lines changed

1 file changed

+24
-38
lines changed

demo-snippets/vue/ColorFilter.vue

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
</ActionBar>
66

77
<GridLayout rows="*, auto, auto">
8-
<NSImg backgroundColor="yellow" ref="opacityImg" placeholderImageUri="res://logo" :colorMatrix="colorMatrix" :src="src"> </NSImg>
9-
<StackLayout orientation="horizontal" row="1">
10-
<Button text="nightVision" row="1" @tap="onSetNightVision"></Button>
11-
<Button text="polaroid" @tap="onSetPolaroid"></Button>
12-
<Button text="grayscale" @tap="onSetGrayscale"></Button>
13-
<Button text="bw" @tap="onSetBW"></Button>
14-
<Button text="clear" @tap="onSetClear"></Button>
15-
</StackLayout>
16-
8+
<NSImg backgroundColor="yellow" ref="opacityImg" placeholderImageUri="res://logo" :colorMatrix="colorMatrix" :src="src"> </NSImg>
9+
<StackLayout orientation="horizontal" row="1">
10+
<Button text="nightVision" row="1" @tap="onSetNightVision"></Button>
11+
<Button text="polaroid" @tap="onSetPolaroid"></Button>
12+
<Button text="grayscale" @tap="onSetGrayscale"></Button>
13+
<Button text="bw" @tap="onSetBW"></Button>
14+
<Button text="clear" @tap="onSetClear"></Button>
15+
</StackLayout>
16+
1717
<Button text="change image" row="2" @tap="onChangeImage"></Button>
1818
</GridLayout>
1919
</Page>
@@ -23,53 +23,39 @@
2323
import { ImageSource } from '@nativescript/core';
2424
2525
const filters = {
26-
nightVision:[0.1, 0.4, 0, 0, 0,
27-
0.3, 1, 0.3, 0, 0,
28-
0, 0.4, 0.1, 0, 0,
29-
0, 0, 0, 1, 0],
30-
polaroid: [
31-
1.438, -0.062, -0.062, 0, 0,
32-
-0.122, 1.378, -0.122, 0, 0,
33-
-0.016, -0.016, 1.483, 0, 0,
34-
0, 0, 0, 1, 0
35-
],
36-
grayscale:[
37-
.299, 0.587, 0.114, 0, 0,
38-
0.299, 0.587, 0.114, 0, 0,
39-
0.299, 0.587, 0.114, 0, 0,
40-
0, 0, 0, 1, 0
41-
],
42-
bw: [1.5, 1.5, 1.5, -1, 0, 1.5, 1.5, 1.5, -1, 0, 1.5, 1.5, 1.5, -1, 0, 0, 0, 0, 1, 0],
43-
44-
}
26+
nightVision: [0.1, 0.4, 0, 0, 0, 0.3, 1, 0.3, 0, 0, 0, 0.4, 0.1, 0, 0, 0, 0, 0, 1, 0],
27+
polaroid: [1.438, -0.062, -0.062, 0, 0, -0.122, 1.378, -0.122, 0, 0, -0.016, -0.016, 1.483, 0, 0, 0, 0, 0, 1, 0],
28+
grayscale: [0.299, 0.587, 0.114, 0, 0, 0.299, 0.587, 0.114, 0, 0, 0.299, 0.587, 0.114, 0, 0, 0, 0, 0, 1, 0],
29+
bw: [1.5, 1.5, 1.5, -1, 0, 1.5, 1.5, 1.5, -1, 0, 1.5, 1.5, 1.5, -1, 0, 0, 0, 0, 1, 0]
30+
};
4531
4632
export default {
47-
data: function() {
33+
data: function () {
4834
return {
49-
colorMatrix:filters.nightVision,
50-
src:'~/assets/images/dessert.jpg',
35+
colorMatrix: filters.nightVision,
36+
src: '~/assets/images/dessert.jpg'
5137
// warning image source native android image will not be released!
5238
// imgSource: ImageSource.fromFileSync('~/assets/images/dessert.jpg')
5339
};
5440
},
5541
methods: {
5642
onSetNightVision(args) {
57-
this.colorMatrix = filters.nightVision
43+
this.colorMatrix = filters.nightVision;
5844
},
5945
onSetPolaroid(args) {
60-
this.colorMatrix = filters.polaroid
46+
this.colorMatrix = filters.polaroid;
6147
},
6248
onSetGrayscale(args) {
63-
this.colorMatrix = filters.grayscale
49+
this.colorMatrix = filters.grayscale;
6450
},
6551
onSetBW(args) {
66-
this.colorMatrix = filters.bw
52+
this.colorMatrix = filters.bw;
6753
},
6854
onSetClear(args) {
69-
this.colorMatrix = null
55+
this.colorMatrix = null;
7056
},
71-
onChangeImage(){
72-
this.src= this.src=== '~/assets/images/dessert.jpg' ? '~/assets/images/drink.jpg': '~/assets/images/dessert.jpg';
57+
onChangeImage() {
58+
this.src = this.src === '~/assets/images/dessert.jpg' ? '~/assets/images/drink.jpg' : '~/assets/images/dessert.jpg';
7359
}
7460
}
7561
};

0 commit comments

Comments
 (0)