Skip to content

Commit aeff66d

Browse files
committed
test: demo app update
1 parent 3807620 commit aeff66d

File tree

9 files changed

+58
-68
lines changed

9 files changed

+58
-68
lines changed

demo-vue/app.webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ module.exports = (env, params = {}) => {
77
const projectRoot = __dirname;
88
const config = webpackConfig(env, params);
99
if (development) {
10-
config.resolve.alias['@nativescript/core'] = '@akylas/nativescript';
1110
const srcPath = resolve(projectRoot, '..', 'src');
1211
config.resolve.alias['@nativescript-community/ui-canvas'] = srcPath;
1312
config.resolve.alias['@nativescript-community/ui-canvas$'] = srcPath;

demo-vue/app/canvastests.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import { Align, Canvas, Cap, DashPathEffect, LinearGradient, Paint, Path, RadialGradient, Rect, RectF, Style, TileMode, createRect, createRectF } from '@nativescript-community/ui-canvas';
2+
import { Label, Utils } from '@nativescript/core';
23
import { Color } from '@nativescript/core/color';
34
import { Folder, knownFolders, path } from '@nativescript/core/file-system';
45
import { ImageSource } from '@nativescript/core/image-source';
5-
import { Button } from '@nativescript/core/ui/button';
6-
import { FormattedString } from '@nativescript/core/text/formatted-string';
7-
import { Span } from '@nativescript/core/text/span';
8-
import { Label, Utils } from '@nativescript/core';
96

107
function isOnUiThread() {
118
if (global.isIOS) {
@@ -14,11 +11,11 @@ function isOnUiThread() {
1411
return android.os.Looper.myLooper() === android.os.Looper.getMainLooper();
1512
}
1613
}
14+
const folder: Folder = knownFolders.currentApp();
15+
const iconLocalFile: ImageSource = ImageSource.fromFileSync(path.join(folder.path, 'images/test.jpg'));
1716

1817
export function drawOnImage(scale = 3, canvas?: Canvas) {
19-
const folder: Folder = knownFolders.currentApp();
2018

21-
const iconLocalFile: ImageSource = ImageSource.fromFileSync(path.join(folder.path, 'images/test.jpg'));
2219
if (!canvas) {
2320
const folderPath: string = path.join(folder.path, 'images/test.jpg');
2421
const imageFromLocalFile: ImageSource = ImageSource.fromFileSync(folderPath);
@@ -122,9 +119,9 @@ export function drawOnImage(scale = 3, canvas?: Canvas) {
122119

123120
// image
124121
canvas.save();
125-
canvas.translate(10, 600);
122+
// canvas.translate(10, 600);
126123
// canvas.drawBitmap(iconLocalFile, 0, 0, null);
127-
canvas.drawBitmap(iconLocalFile, null, createRect(150, 0, 200, 300), null);
124+
canvas.drawBitmap(iconLocalFile, null, createRect(0, 0, 200, 300), null);
128125
canvas.restore();
129126

130127
// arc path

demo-vue/app/examples/Animation.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { Canvas, Cap, createRect, createRectF, Paint, Style } from '@nativescrip
1818
import { Color } from '@nativescript/core/color';
1919
import { Screen } from '@nativescript/core/platform';
2020
21-
import TWEEN from 'nativescript-tween';
21+
import TWEEN from '@nativescript-community/tween';
2222
2323
@Component
2424
export default class Animation extends Vue {
@@ -55,7 +55,7 @@ export default class Animation extends Vue {
5555
this.currentArcAngle = obj.value;
5656
canvas.redraw();
5757
})
58-
.start();
58+
.start(0);
5959
}
6060
}
6161
</script>

demo-vue/app/examples/Image.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<NavigationButton text="Back" android.systemIcon="ic_menu_back" @tap="onBack"></NavigationButton>
55
</ActionBar>
66
<StackLayout>
7-
<CanvasView width="100%" height="100%" @draw="onDraw"/>
7+
<CanvasView width="100%" height="100%" @draw="onDraw" />
88
</StackLayout>
99
</Page>
1010
</template>
@@ -16,10 +16,10 @@ import { Component } from 'vue-property-decorator';
1616
import { createRect, Paint, Style } from '@nativescript-community/ui-canvas';
1717
import { Color } from '@nativescript/core/color';
1818
import { Folder, knownFolders, path } from '@nativescript/core/file-system';
19-
import { fromFile, ImageSource } from '@nativescript/core/image-source';
19+
import { ImageSource } from '@nativescript/core/image-source';
2020
import { Screen } from '@nativescript/core/platform';
2121
22-
const iconLocalFile: ImageSource = fromFile(path.join( knownFolders.currentApp().path, 'images/test.jpg'));
22+
const iconLocalFile: ImageSource = ImageSource.fromFileSync(path.join(knownFolders.currentApp().path, 'images/test.jpg'));
2323
2424
@Component
2525
export default class Image extends Vue {

demo-vue/app/examples/Shapes.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import Vue from 'nativescript-vue';
4545
import { Component } from 'vue-property-decorator';
4646
import { Canvas, createRect, Paint, Style } from '@nativescript-community/ui-canvas';
4747
import { Color } from '@nativescript/core';
48-
import TWEEN from 'nativescript-tween';
48+
import TWEEN from '@nativescript-community/tween';
4949
import { Screen } from '@nativescript/core/platform';
5050
5151
@Component
@@ -72,15 +72,15 @@ export default class Simple extends Vue {
7272
.onUpdate(obj => {
7373
this.shapeLeft = obj.value;
7474
})
75-
.start();
75+
.start(0);
7676
}
7777
animateArc() {
7878
new TWEEN.Tween({ value: 0 })
7979
.to({ value: 360 }, 5000)
8080
.onUpdate(obj => {
8181
this.sweepAngle = obj.value;
8282
})
83-
.start();
83+
.start(0);
8484
}
8585
8686
onDraw(event: { canvas: Canvas }) {

demo-vue/app/examples/index.ts

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,25 @@ import Shapes from './Shapes.vue';
55
import Image from './Image.vue';
66

77
export { Complex, Simple, Animation, Shapes };
8-
export const getExamples = () => {
9-
return [
10-
{
11-
name: 'Complex',
12-
component: Complex
13-
},
14-
{
15-
name: 'Simple',
16-
component: Simple
17-
},
18-
{
19-
name: 'Animation',
20-
component: Animation
21-
},
22-
{
23-
name: 'Shapes',
24-
component: Shapes
25-
},
26-
{
27-
name: 'Image',
28-
component: Image
29-
}
30-
];
31-
};
8+
export const getExamples = () => [
9+
{
10+
name: 'Complex',
11+
component: Complex
12+
},
13+
{
14+
name: 'Simple',
15+
component: Simple
16+
},
17+
{
18+
name: 'Animation',
19+
component: Animation
20+
},
21+
{
22+
name: 'Shapes',
23+
component: Shapes
24+
},
25+
{
26+
name: 'Image',
27+
component: Image
28+
}
29+
];

demo-vue/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
"repository": "http://www.github.com/Akylas/@nativescript-community/ui-canvas.git",
66
"main": "main.js",
77
"dependencies": {
8-
"@akylas/nativescript": "7.0.3-alpha.4",
8+
"@nativescript/core": "7.0.3",
99
"@nativescript-community/perms": "2.1.1",
1010
"@nativescript-community/ui-canvas": "file:../plugin",
11-
"@nativescript/webpack": "3.0.4",
12-
"nativescript-tween": "0.0.10",
11+
"@nativescript/webpack": "3.0.7",
12+
"@nativescript-community/tween": "0.0.12",
1313
"nativescript-vue": "^2.8.1"
1414
},
1515
"devDependencies": {
1616
"@babel/core": "^7.11.6",
1717
"@nativescript/android": "7.0.0",
18-
"@nativescript/core": "7.0.3",
1918
"@nativescript/types": "7.0.3",
2019
"babel-loader": "^8.1.0",
2120
"nativescript-vue-template-compiler": "2.8.1",
@@ -25,4 +24,4 @@
2524
"vue-loader": "^15.9.3",
2625
"vue-property-decorator": "^8.5.1"
2726
}
28-
}
27+
}

demo-vue/pnpm-lock.yaml

Lines changed: 17 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo-vue/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
4-
"module": "commonjs",
3+
"target": "es2017",
4+
"module": "esnext",
55
"moduleResolution": "node",
66
"incremental": true,
77
"tsBuildInfoFile": ".tsbuildinfo",

0 commit comments

Comments
 (0)