scanner: Update frame page
This commit is contained in:
parent
a586f03376
commit
a766eb1951
@ -10,7 +10,7 @@ Page({
|
|||||||
data: {
|
data: {
|
||||||
uploaded: 0,
|
uploaded: 0,
|
||||||
failed: 0,
|
failed: 0,
|
||||||
session_id: Date.now(),
|
session_id: null,
|
||||||
frame_id: 0,
|
frame_id: 0,
|
||||||
next_upload_time: 0,
|
next_upload_time: 0,
|
||||||
uploading: false,
|
uploading: false,
|
||||||
@ -73,20 +73,24 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
set_pos() {
|
set_pos() {
|
||||||
|
const session_id = new Date().toISOString() + "_pos";
|
||||||
this.setData({
|
this.setData({
|
||||||
label: "pos",
|
label: "pos",
|
||||||
pos_class: "active",
|
pos_class: "active",
|
||||||
neg_class: "",
|
neg_class: "",
|
||||||
stop_class: "",
|
stop_class: "",
|
||||||
|
session_id,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
set_neg() {
|
set_neg() {
|
||||||
|
const session_id = new Date().toISOString() + "_neg";
|
||||||
this.setData({
|
this.setData({
|
||||||
label: "neg",
|
label: "neg",
|
||||||
pos_class: "",
|
pos_class: "",
|
||||||
neg_class: "active",
|
neg_class: "active",
|
||||||
stop_class: "",
|
stop_class: "",
|
||||||
|
session_id,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
stop() {
|
stop() {
|
||||||
@ -105,6 +109,7 @@ Page({
|
|||||||
})
|
})
|
||||||
const listener = ctx.onCameraFrame((res) => { this.handle_frame(res) });
|
const listener = ctx.onCameraFrame((res) => { this.handle_frame(res) });
|
||||||
listener.start();
|
listener.start();
|
||||||
|
this.ctx = ctx;
|
||||||
},
|
},
|
||||||
handle_frame(res) {
|
handle_frame(res) {
|
||||||
if (!this.data.label || this.data.uploading) {
|
if (!this.data.label || this.data.uploading) {
|
||||||
@ -150,4 +155,19 @@ Page({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
zoom_1x() {
|
||||||
|
this.ctx.setZoom({
|
||||||
|
zoom: 1,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
zoom_2x() {
|
||||||
|
this.ctx.setZoom({
|
||||||
|
zoom: 2,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
zoom_4x() {
|
||||||
|
this.ctx.setZoom({
|
||||||
|
zoom: 4,
|
||||||
|
});
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@ -3,6 +3,9 @@
|
|||||||
<button class="{{pos_class}}" bind:tap="set_pos">Pos</button>
|
<button class="{{pos_class}}" bind:tap="set_pos">Pos</button>
|
||||||
<button class="{{neg_class}}" bind:tap="set_neg">Neg</button>
|
<button class="{{neg_class}}" bind:tap="set_neg">Neg</button>
|
||||||
<button class="{{stop_class}}" bind:tap="stop">Stop</button>
|
<button class="{{stop_class}}" bind:tap="stop">Stop</button>
|
||||||
|
<button bind:tap="zoom_1x">1x</button>
|
||||||
|
<button bind:tap="zoom_2x">2x</button>
|
||||||
|
<button bind:tap="zoom_4x">4x</button>
|
||||||
<view>
|
<view>
|
||||||
uploaded: {{ uploaded }}
|
uploaded: {{ uploaded }}
|
||||||
failed: {{ failed }}
|
failed: {{ failed }}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user