mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2025-02-20 20:21:38 +01:00
perf: 🚀 Add screen rotation shortcut menu
This commit is contained in:
parent
f460f036a6
commit
dd601dfdfe
@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<el-dropdown :disabled="loading" @command="handleCommand">
|
||||
<div class="">
|
||||
<slot :loading="loading" />
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
v-for="item of options"
|
||||
:key="item.value"
|
||||
:command="item.value"
|
||||
>
|
||||
{{ $t(item.label) }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { sleep } from '@/utils'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
device: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
commandMap: {
|
||||
vertically:
|
||||
'content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0',
|
||||
horizontally:
|
||||
'content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1',
|
||||
auto: 'content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:1',
|
||||
disable:
|
||||
'content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0',
|
||||
},
|
||||
options: [
|
||||
{
|
||||
label: 'device.control.rotation.vertically',
|
||||
value: 'vertically',
|
||||
},
|
||||
{
|
||||
label: 'device.control.rotation.horizontally',
|
||||
value: 'horizontally',
|
||||
},
|
||||
{
|
||||
label: 'device.control.rotation.auto',
|
||||
value: 'auto',
|
||||
},
|
||||
{
|
||||
label: 'device.control.rotation.disable',
|
||||
value: 'disable',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async handleCommand(value) {
|
||||
this.loading = true
|
||||
|
||||
const command = this.commandMap[value]
|
||||
|
||||
if (value === 'vertically' || value === 'horizontally') {
|
||||
await this.$adb.deviceShell(this.device.id, this.commandMap.disable)
|
||||
await sleep(500)
|
||||
}
|
||||
|
||||
this.$adb.deviceShell(this.device.id, command)
|
||||
|
||||
this.loading = false
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style></style>
|
@ -50,6 +50,7 @@ import Screenshot from './Screenshot/index.vue'
|
||||
import AppInstall from './AppInstall/index.vue'
|
||||
import Gnirehtet from './Gnirehtet/index.vue'
|
||||
import MirrorGroup from './MirrorGroup/index.vue'
|
||||
import Rotation from './Rotation/index.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -57,6 +58,7 @@ export default {
|
||||
AppInstall,
|
||||
Gnirehtet,
|
||||
MirrorGroup,
|
||||
Rotation,
|
||||
},
|
||||
props: {
|
||||
device: {
|
||||
@ -99,6 +101,11 @@ export default {
|
||||
elIcon: 'RefreshLeft',
|
||||
command: 'reboot',
|
||||
},
|
||||
{
|
||||
label: 'device.control.rotation.name',
|
||||
svgIcon: 'rotation',
|
||||
component: 'Rotation',
|
||||
},
|
||||
{
|
||||
label: 'device.control.volume-down.name',
|
||||
svgIcon: 'volume-down',
|
||||
|
1
src/icons/svg/rotation.svg
Normal file
1
src/icons/svg/rotation.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 24 24"><path fill="currentColor" d="M16.48 2.52c3.27 1.55 5.61 4.72 5.97 8.48h1.5C23.44 4.84 18.29 0 12 0l-.66.03l3.81 3.81l1.33-1.32zm-6.25-.77a1.49 1.49 0 0 0-2.12 0L1.75 8.11a1.49 1.49 0 0 0 0 2.12l12.02 12.02c.59.59 1.54.59 2.12 0l6.36-6.36c.59-.59.59-1.54 0-2.12L10.23 1.75zm4.6 19.44L2.81 9.17l6.36-6.36l12.02 12.02l-6.36 6.36zm-7.31.29A10.487 10.487 0 0 1 1.55 13H.05C.56 19.16 5.71 24 12 24l.66-.03l-3.81-3.81l-1.33 1.32z"/></svg>
|
After Width: | Height: | Size: 516 B |
@ -103,6 +103,11 @@
|
||||
"device.control.volume-up.name": "Volume Up",
|
||||
"device.control.volume-down.name": "Volume Down",
|
||||
"device.control.volume-mute.name": "Mute",
|
||||
"device.control.rotation.name": "Rotation",
|
||||
"device.control.rotation.vertically": "Vertically",
|
||||
"device.control.rotation.horizontally": "Horizontally",
|
||||
"device.control.rotation.auto": "Auto",
|
||||
"device.control.rotation.disable": "Disable",
|
||||
|
||||
"preferences.name": "Preferences",
|
||||
"preferences.reset": "Reset to Default",
|
||||
|
@ -101,6 +101,11 @@
|
||||
"device.control.volume-up.name": "增加音量",
|
||||
"device.control.volume-down.name": "减小音量",
|
||||
"device.control.volume-mute.name": "静音",
|
||||
"device.control.rotation.name": "旋转屏幕",
|
||||
"device.control.rotation.vertically": "纵向旋转",
|
||||
"device.control.rotation.horizontally": "横向旋转",
|
||||
"device.control.rotation.auto": "自动旋转",
|
||||
"device.control.rotation.disable": "禁用旋转",
|
||||
|
||||
"preferences.name": "偏好设置",
|
||||
"preferences.reset": "恢复默认值",
|
||||
|
Loading…
x
Reference in New Issue
Block a user