Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
fixed #36
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkame committed May 14, 2020
1 parent 02d3f53 commit 13a25b1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
5 changes: 5 additions & 0 deletions public/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ contextBridge.exposeInMainWorld(

ipcRenderer.on('drop-file', (e, data) => {
const event = new CustomEvent('drop-file', {detail:data})
document.dispatchEvent(event)
})

ipcRenderer.on('toggle-draw', (e) => {
const event = new Event('toggle-draw')
document.dispatchEvent(event)
})

13 changes: 10 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template lang="pug">
#app(@drop="dropFile", @dragover.prevent, @dragenter.prevent, @keydown.shift="pen =true", @keyup="pen =false", tabindex="0")
#app(@drop="dropFile", @dragover.prevent, @dragenter.prevent, tabindex="0")

Moveable.moveable(
v-if="camera_stream && !full_screen_camera",
Expand All @@ -25,8 +25,9 @@
BlankTab(:tab='tab', v-if='tab.type === "BlankTab"' @changeTab='changeTab')
FileTab(:tab='tab', v-if='tab.type === "FileTab"')
CaptureTab(:tab='tab', v-if='tab.type === "CaptureTab"')
svg.pen_field(v-if="pen", @mousemove.prevent="pen_stroke", @mousedown="pen_start",@mouseout="pen_end",@mouseup="pen_end")
path(:d="strokeToPathString(stroke)", v-for="stroke in pen_strokes", fill="transparent" stroke="red" stroke-width="5").path
svg.pen_field(v-if="pen", @mousemove.prevent="pen_stroke", @mousedown="pen_start",@mouseout="pen_end",@mouseup="pen_end")
span ペンモード Ctrl+D で終了
path(:d="strokeToPathString(stroke)", v-for="stroke in pen_strokes", fill="transparent" stroke="red" stroke-width="5").path

.footer-bar-wrapper
.footer-bar
Expand Down Expand Up @@ -211,6 +212,10 @@
})
console.log(vm.tabs)
})
document.addEventListener('toggle-draw', () => {
vm.pen = !vm.pen
console.log('draw')
})
}
Expand All @@ -231,6 +236,8 @@
top: 0;
width: 100%;
height: 100%;
box-shadow: inset 0px 0px 10px 0px rgba(255,0,0,1)
}
html, body, #app {
Expand Down
10 changes: 9 additions & 1 deletion src/background.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
'use strict'

import {app, BrowserWindow, protocol} from 'electron'
import {app, BrowserWindow, protocol, globalShortcut} from 'electron'
import {createProtocol,} from 'vue-cli-plugin-electron-builder/lib'
import fs from 'fs'
import path from 'path'
const mime = require('mime')
const localShortcut = require("electron-localshortcut");

const isDevelopment = process.env.NODE_ENV !== 'production'

// Keep a global reference of the window object, if you don't, the window will
Expand Down Expand Up @@ -50,6 +52,12 @@ function createWindow() {
name: path.basename(filepath)
})
})
let ret = globalShortcut.register('CommandOrControl+D', () => {
webContents.send('toggle-draw')

})



}

Expand Down

0 comments on commit 13a25b1

Please sign in to comment.