Skip to content

Commit d9ec94f

Browse files
committed
添加截图上传按钮
1 parent c0cc1a5 commit d9ec94f

4 files changed

Lines changed: 18 additions & 7 deletions

File tree

.github/workflows/go-build-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
- name: Get version
3939
id: get_version
40-
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
40+
run: echo "VERSION=${{github.event.client_payload.tag}}" >>$GITHUB_OUTPUT
4141

4242
- name: Build amd64
4343
run: CGO_ENABLE=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X main.go_build_version=${{ steps.get_version.outputs.VERSION }}" -o go-touch-mapper_amd64

go-touch-mapper-gh-pages/src/components/ConfigManager.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,11 @@ export default function ConfigManager() {
259259
// setUploadButton(false);
260260
const reads = new FileReader();
261261
reads.readAsDataURL(document.getElementById('fileInput').files[0]);
262-
reads.onload = function (e) {
263-
setImgUrl(this.result);
262+
reads.onload = async function (e) {
263+
// setImgUrl(this.result);
264+
// document.body.requestFullscreen();
265+
const bas64STR = await imageUrlToBase64(this.result)
266+
setConfig(produce(draft => { draft.IMG = bas64STR }))
264267
document.body.requestFullscreen();
265268
};
266269
}
@@ -442,7 +445,15 @@ export default function ConfigManager() {
442445
marginTop: "10px",
443446
}}
444447
>{"5s后获取截图"}</Button>
445-
448+
</Grid>
449+
<Grid item xs={12}>
450+
<Button
451+
onClick={() => { document.getElementById('fileInput').click(); }}
452+
variant="outlined"
453+
sx={{
454+
width: "100%",
455+
}}
456+
>{"上传截图"}</Button>
446457
</Grid>
447458
</Grid>
448459
<Button
@@ -1062,5 +1073,7 @@ export default function ConfigManager() {
10621073
shift_range={config["WHEEL"]["SHIFT_RANGE_ENABLE"] ? getPostionValueX(config["WHEEL"]["SHIFT_RANGE"]) : 0}
10631074
/>
10641075
<ViewShow x={getPostionValueX(config["MOUSE"]["POS"][0])} y={getPostionValueY(config["MOUSE"]["POS"][1])} />
1076+
<input id="fileInput" type="file" style={{ display: "none" }} accept="image/*" onChange={handleFileChange} ></input>
1077+
10651078
</div>
10661079
}

go-touch-mapper-gh-pages/src/components/UIcomponents.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ const CostumedInput = ({ defaultValue, width, onCommit }) => {
104104
const [value, setValue] = useState(defaultValue)
105105
return <Input
106106
sx={{ width: width || "40px" }}
107-
// inputProps={{ inputMode: 'numeric', pattern: '[0-9]*' }}
108107
value={value}
109108
onChange={(e) => {
110109
setValue(e.target.value)

v_mouse.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ func init_v_mouse_controller(
7171
data := make([]byte, n)
7272
copy(data, readBuffer[:n])
7373
global_device_orientation = int32(data[0])
74-
logger.Infof("从 %s 接收到 vpoint上报屏幕方向 %d ", remoteAddr.String(), int32(data[0]))
75-
74+
logger.Debugf("从 %s 接收到 vpoint上报屏幕方向 %d ", remoteAddr.String(), int32(data[0]))
7675
}
7776
}
7877
}

0 commit comments

Comments
 (0)