mirror of
https://github.com/Macrame-App/Macrame
synced 2025-12-29 15:29:26 +00:00
MacroView page added, Recorder store and service added, route added.
This commit is contained in:
parent
fff132a11b
commit
973f8c67b0
5 changed files with 115 additions and 8 deletions
7
fe/src/services/ApiService.js
Normal file
7
fe/src/services/ApiService.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export const appUrl = () => {
|
||||
return window.location.port !== 6970 ? `http://${window.location.hostname}:6970` : ''
|
||||
}
|
||||
|
||||
export const isLocal = () => {
|
||||
return window.location.hostname === '127.0.0.1' || window.location.hostname === 'localhost'
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ export const filterKey = (e) => {
|
|||
if (e.location === 1) k.loc = 'left'
|
||||
if (e.location === 2) k.loc = 'right'
|
||||
if (e.location === 3) k.loc = 'num'
|
||||
|
||||
|
||||
if (e.key.includes('Media') || e.key.includes('Audio')) k.loc = mediaPrefix(e)
|
||||
|
||||
// If code is in keyMap, set str by code
|
||||
|
|
@ -104,3 +104,24 @@ export const isRepeat = (lastStep, e, direction) => {
|
|||
lastStep.direction === direction
|
||||
)
|
||||
}
|
||||
|
||||
export const invalidMacro = (steps) => {
|
||||
const downKeys = []
|
||||
const upKeys = []
|
||||
|
||||
Object.keys(steps).forEach((stepKey) => {
|
||||
const step = steps[stepKey]
|
||||
|
||||
if (step.type !== 'key') return
|
||||
|
||||
if (step.direction == 'down') downKeys.push(step.key)
|
||||
if (step.direction == 'up') {
|
||||
if (!downKeys.includes(step.key)) upKeys.push(step.key)
|
||||
else downKeys.splice(downKeys.indexOf(step.key), 1)
|
||||
}
|
||||
})
|
||||
|
||||
if (upKeys.length === 0 && downKeys.length === 0) return false
|
||||
|
||||
return { down: downKeys, up: upKeys }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue