From e03937b26256f96ff8481e838280042f6f44c454 Mon Sep 17 00:00:00 2001 From: hjwforever Date: Sun, 22 Sep 2024 00:47:18 +0800 Subject: [PATCH] fix: image rotate and flip --- package.json | 474 ++-- src/main/index.js | 196 +- .../views/image/components/ImageCanvas.vue | 2515 +++++++++-------- 3 files changed, 1602 insertions(+), 1583 deletions(-) diff --git a/package.json b/package.json index ef0c314..d0fa001 100644 --- a/package.json +++ b/package.json @@ -1,237 +1,237 @@ -{ - "name": "MegSpot", - "version": "v2.2.19", - "author": "weiyajun ", - "description": "A tool to improve the viewing of pictures and videos by researchers", - "homepage": "https://github.com/MegEngine/MegSpot", - "license": "Apache License Version 2.0", - "main": "./dist/electron/main.js", - "scripts": { - "dev": "cross-env BUILD_TARGET=clean node .electron-vue/build.js && node .electron-vue/dev-runner.js", - "build": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js", - "build:win32": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --win --ia32", - "build:win64": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --win --x64", - "build:mac": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --mac", - "build:linux": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --linux", - "build:dir": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --dir", - "build:ml": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && sudo electron-builder -ml", - "build:all": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && sudo electron-builder -wml", - "publish:all": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && sudo electron-builder -wml -p onTag", - "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js", - "build:web": "cross-env BUILD_TARGET=web ENV_TARGET=web node .electron-vue/build.js", - "pack": "npm run pack:main && npm run pack:renderer", - "pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js", - "lint": "eslint --ext .js,.vue src", - "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js", - "dep:upgrade": "yarn upgrade-interactive --latest", - "postinstall": "electron-builder install-app-deps", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", - "e2e": "playwright test" - }, - "build": { - "extraFiles": [], - "publish": [ - { - "provider": "github", - "private": false, - "repo": "MegSpot", - "owner": "MegEngine", - "releaseType": "release" - } - ], - "productName": "MegSpot", - "artifactName": "${productName}-${version}-${os}-${arch}.${ext}", - "appId": "org.megvii.megspot", - "copyright": " Copyright (c) 2022 Megvii Inc. All rights reserved.", - "releaseInfo": { - "releaseNotes": "一、新增功能:\n 1. 支持`image`和`canvas`两种显示模式;\n 2. 支持显示在`image`模式下显示`HDR`原图图像。", - "releaseDate": "2024.08.11" - }, - "directories": { - "output": "build" - }, - "files": [ - "dist/electron/**/*" - ], - "extraResources": [ - "LICENSE", - "COPYRIGHT", - "CONTRIBUTOR LICENSE AGREEMENT" - ], - "dmg": { - "contents": [ - { - "x": 410, - "y": 150, - "type": "link", - "path": "/Applications" - }, - { - "x": 130, - "y": 150, - "type": "file" - } - ] - }, - "mac": { - "icon": "build/icons/logo.icns", - "category": "public.app-category.utilities", - "target": [ - { - "target": "dmg", - "arch": [ - "x64", - "arm64" - ] - } - ] - }, - "win": { - "icon": "build/icons/logo.ico" - }, - "linux": { - "target": [ - "AppImage" - ], - "category": "Utility" - }, - "nsis": { - "oneClick": false, - "allowToChangeInstallationDirectory": true - } - }, - "dependencies": { - "@dhdbstjr98/gif.js": "^1.0.2", - "@electron/remote": "^2.0.8", - "@popperjs/core": "^2.9.2", - "axios": "^0.21.1", - "chokidar": "^3.5.2", - "dayjs": "^1.10.4", - "electron-log": "^4.3.4", - "electron-store": "^8.1.0", - "electron-updater": "^4.3.5", - "element-ui": "^2.15.0", - "ex-utils": "^0.0.4", - "express": "^4.17.1", - "file-saver": "^2.0.5", - "flex.css": "^1.1.7", - "fs-extra": "^9.1.0", - "jszip": "^3.10.0", - "lodash": "^4.17.21", - "mediainfo.js": "^0.1.8", - "swiper": "5.2.0", - "utif2": "^4.0.1", - "viewerjs": "^1.9.0", - "vue": "^2.6.12", - "vue-awesome-swiper": "^4.1.1", - "vue-i18n": "^8.22.4", - "vue-router": "^3.4.9", - "vue-split-panel": "^1.0.4", - "vuedraggable": "^2.24.3", - "vuescroll": "^4.17.3", - "vuex": "^3.6.0", - "vuex-electron-store": "^1.4.26", - "vxe-table": "^3.4.5", - "xe-utils": "^3.4.0" - }, - "devDependencies": { - "@babel/core": "^7.12.10", - "@babel/plugin-proposal-class-properties": "^7.12.1", - "@babel/plugin-proposal-decorators": "^7.12.12", - "@babel/plugin-proposal-do-expressions": "^7.12.1", - "@babel/plugin-proposal-export-default-from": "^7.12.1", - "@babel/plugin-proposal-export-namespace-from": "^7.12.1", - "@babel/plugin-proposal-function-bind": "^7.12.1", - "@babel/plugin-proposal-function-sent": "^7.12.1", - "@babel/plugin-proposal-json-strings": "^7.12.1", - "@babel/plugin-proposal-logical-assignment-operators": "^7.12.1", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", - "@babel/plugin-proposal-numeric-separator": "^7.12.7", - "@babel/plugin-proposal-optional-chaining": "^7.12.7", - "@babel/plugin-proposal-pipeline-operator": "^7.12.1", - "@babel/plugin-proposal-throw-expressions": "^7.12.1", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.10.4", - "@babel/plugin-transform-modules-umd": "^7.14.5", - "@babel/plugin-transform-runtime": "^7.12.10", - "@babel/polyfill": "^7.12.1", - "@babel/preset-env": "^7.12.11", - "@babel/register": "^7.12.10", - "@babel/runtime": "^7.12.5", - "@types/fs-extra": "^9.0.6", - "@types/node": "^14.14.22", - "babel-eslint": "^9.0.0", - "babel-loader": "^8.2.2", - "babel-plugin-import": "^1.13.3", - "cache-loader": "^4.1.0", - "chalk": "^4.0.0", - "copy-webpack-plugin": "^6.3.2", - "cross-env": "^7.0.3", - "css-loader": "^5.0.1", - "del": "^6.0.0", - "dmg-builder": "23.6.0", - "electron": "^26.6.10", - "electron-builder": "^24.13.3", - "electron-devtools-vendor": "^1.1.0", - "esbuild-loader": "^2.19.0", - "eslint": "^6.8.0", - "eslint-config-standard": "^14.1.1", - "eslint-friendly-formatter": "^4.0.1", - "eslint-loader": "^3.0.4", - "eslint-plugin-html": "^6.1.1", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-node": "^9.2.0", - "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-standard": "^4.1.0", - "eslint-plugin-vue": "^7.5.0", - "file-loader": "^6.2.0", - "firebase": "^9.15.0", - "git-cz": "^4.7.6", - "html-webpack-plugin": "^4.5.1", - "husky": "^4.3.8", - "lint-staged": "^10.5.3", - "mini-css-extract-plugin": "1.3.4", - "multispinner": "^0.2.1", - "node-loader": "^1.0.2", - "portfinder": "^1.0.28", - "prettier": "^2.7.0", - "sass": "1.32.5", - "sass-loader": "^10.1.1", - "string-replace-loader": "^3.1.0", - "style-loader": "^2.0.0", - "svg-sprite-loader": "^5.2.1", - "terser-webpack-plugin": "^4.2.3", - "timing-object": "^3.1.48", - "timingsrc": "^1.2.8", - "url-loader": "^4.1.1", - "vue-html-loader": "^1.2.4", - "vue-loader": "^15.9.6", - "vue-slider-component": "^3.2.23", - "vue-style-loader": "^4.1.2", - "vue-template-compiler": "^2.6.12", - "webpack": "^4.44.2", - "webpack-cli": "^3.3.12", - "webpack-dev-server": "^3.11.2", - "webpack-hot-middleware": "^2.25.0", - "webpack-merge": "^5.7.3" - }, - "lint-staged": { - "src/**/*.{js,vue}": [ - "git add" - ] - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "config": { - "commitizen": { - "path": "git-cz" - } - }, - "volta": { - "node": "18.20.4", - "yarn": "1.22.21" - } -} +{ + "name": "MegSpot", + "version": "v2.2.20", + "author": "weiyajun ", + "description": "A tool to improve the viewing of pictures and videos by researchers", + "homepage": "https://github.com/MegEngine/MegSpot", + "license": "Apache License Version 2.0", + "main": "./dist/electron/main.js", + "scripts": { + "dev": "cross-env BUILD_TARGET=clean node .electron-vue/build.js && node .electron-vue/dev-runner.js", + "build": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js", + "build:win32": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --win --ia32", + "build:win64": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --win --x64", + "build:mac": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --mac", + "build:linux": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --linux", + "build:dir": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && electron-builder --dir", + "build:ml": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && sudo electron-builder -ml", + "build:all": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && sudo electron-builder -wml", + "publish:all": "cross-env BUILD_TARGET=clean NODE_ENV=production node .electron-vue/build.js && node .electron-vue/build.js && sudo electron-builder -wml -p onTag", + "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js", + "build:web": "cross-env BUILD_TARGET=web ENV_TARGET=web node .electron-vue/build.js", + "pack": "npm run pack:main && npm run pack:renderer", + "pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js", + "lint": "eslint --ext .js,.vue src", + "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js", + "dep:upgrade": "yarn upgrade-interactive --latest", + "postinstall": "electron-builder install-app-deps", + "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", + "e2e": "playwright test" + }, + "build": { + "extraFiles": [], + "publish": [ + { + "provider": "github", + "private": false, + "repo": "MegSpot", + "owner": "MegEngine", + "releaseType": "release" + } + ], + "productName": "MegSpot", + "artifactName": "${productName}-${version}-${os}-${arch}.${ext}", + "appId": "org.megvii.megspot", + "copyright": " Copyright (c) 2022 Megvii Inc. All rights reserved.", + "releaseInfo": { + "releaseNotes": "一、修复:\n 1. 修复新图像模式下的旋转和翻转。", + "releaseDate": "2024.00.22" + }, + "directories": { + "output": "build" + }, + "files": [ + "dist/electron/**/*" + ], + "extraResources": [ + "LICENSE", + "COPYRIGHT", + "CONTRIBUTOR LICENSE AGREEMENT" + ], + "dmg": { + "contents": [ + { + "x": 410, + "y": 150, + "type": "link", + "path": "/Applications" + }, + { + "x": 130, + "y": 150, + "type": "file" + } + ] + }, + "mac": { + "icon": "build/icons/logo.icns", + "category": "public.app-category.utilities", + "target": [ + { + "target": "dmg", + "arch": [ + "x64", + "arm64" + ] + } + ] + }, + "win": { + "icon": "build/icons/logo.ico" + }, + "linux": { + "target": [ + "AppImage" + ], + "category": "Utility" + }, + "nsis": { + "oneClick": false, + "allowToChangeInstallationDirectory": true + } + }, + "dependencies": { + "@dhdbstjr98/gif.js": "^1.0.2", + "@electron/remote": "^2.0.8", + "@popperjs/core": "^2.9.2", + "axios": "^0.21.1", + "chokidar": "^3.5.2", + "dayjs": "^1.10.4", + "electron-log": "^4.3.4", + "electron-store": "^8.1.0", + "electron-updater": "^4.3.5", + "element-ui": "^2.15.0", + "ex-utils": "^0.0.4", + "express": "^4.17.1", + "file-saver": "^2.0.5", + "flex.css": "^1.1.7", + "fs-extra": "^9.1.0", + "jszip": "^3.10.0", + "lodash": "^4.17.21", + "mediainfo.js": "^0.1.8", + "swiper": "5.2.0", + "utif2": "^4.0.1", + "viewerjs": "^1.9.0", + "vue": "^2.6.12", + "vue-awesome-swiper": "^4.1.1", + "vue-i18n": "^8.22.4", + "vue-router": "^3.4.9", + "vue-split-panel": "^1.0.4", + "vuedraggable": "^2.24.3", + "vuescroll": "^4.17.3", + "vuex": "^3.6.0", + "vuex-electron-store": "^1.4.26", + "vxe-table": "^3.4.5", + "xe-utils": "^3.4.0" + }, + "devDependencies": { + "@babel/core": "^7.12.10", + "@babel/plugin-proposal-class-properties": "^7.12.1", + "@babel/plugin-proposal-decorators": "^7.12.12", + "@babel/plugin-proposal-do-expressions": "^7.12.1", + "@babel/plugin-proposal-export-default-from": "^7.12.1", + "@babel/plugin-proposal-export-namespace-from": "^7.12.1", + "@babel/plugin-proposal-function-bind": "^7.12.1", + "@babel/plugin-proposal-function-sent": "^7.12.1", + "@babel/plugin-proposal-json-strings": "^7.12.1", + "@babel/plugin-proposal-logical-assignment-operators": "^7.12.1", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", + "@babel/plugin-proposal-numeric-separator": "^7.12.7", + "@babel/plugin-proposal-optional-chaining": "^7.12.7", + "@babel/plugin-proposal-pipeline-operator": "^7.12.1", + "@babel/plugin-proposal-throw-expressions": "^7.12.1", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/plugin-transform-modules-umd": "^7.14.5", + "@babel/plugin-transform-runtime": "^7.12.10", + "@babel/polyfill": "^7.12.1", + "@babel/preset-env": "^7.12.11", + "@babel/register": "^7.12.10", + "@babel/runtime": "^7.12.5", + "@types/fs-extra": "^9.0.6", + "@types/node": "^14.14.22", + "babel-eslint": "^9.0.0", + "babel-loader": "^8.2.2", + "babel-plugin-import": "^1.13.3", + "cache-loader": "^4.1.0", + "chalk": "^4.0.0", + "copy-webpack-plugin": "^6.3.2", + "cross-env": "^7.0.3", + "css-loader": "^5.0.1", + "del": "^6.0.0", + "dmg-builder": "23.6.0", + "electron": "^26.6.10", + "electron-builder": "^24.13.3", + "electron-devtools-vendor": "^1.1.0", + "esbuild-loader": "^2.19.0", + "eslint": "^6.8.0", + "eslint-config-standard": "^14.1.1", + "eslint-friendly-formatter": "^4.0.1", + "eslint-loader": "^3.0.4", + "eslint-plugin-html": "^6.1.1", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-node": "^9.2.0", + "eslint-plugin-promise": "^4.2.1", + "eslint-plugin-standard": "^4.1.0", + "eslint-plugin-vue": "^7.5.0", + "file-loader": "^6.2.0", + "firebase": "^9.15.0", + "git-cz": "^4.7.6", + "html-webpack-plugin": "^4.5.1", + "husky": "^4.3.8", + "lint-staged": "^10.5.3", + "mini-css-extract-plugin": "1.3.4", + "multispinner": "^0.2.1", + "node-loader": "^1.0.2", + "portfinder": "^1.0.28", + "prettier": "^2.7.0", + "sass": "1.32.5", + "sass-loader": "^10.1.1", + "string-replace-loader": "^3.1.0", + "style-loader": "^2.0.0", + "svg-sprite-loader": "^5.2.1", + "terser-webpack-plugin": "^4.2.3", + "timing-object": "^3.1.48", + "timingsrc": "^1.2.8", + "url-loader": "^4.1.1", + "vue-html-loader": "^1.2.4", + "vue-loader": "^15.9.6", + "vue-slider-component": "^3.2.23", + "vue-style-loader": "^4.1.2", + "vue-template-compiler": "^2.6.12", + "webpack": "^4.44.2", + "webpack-cli": "^3.3.12", + "webpack-dev-server": "^3.11.2", + "webpack-hot-middleware": "^2.25.0", + "webpack-merge": "^5.7.3" + }, + "lint-staged": { + "src/**/*.{js,vue}": [ + "git add" + ] + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "config": { + "commitizen": { + "path": "git-cz" + } + }, + "volta": { + "node": "18.20.4", + "yarn": "1.22.21" + } +} diff --git a/src/main/index.js b/src/main/index.js index 3dca780..dff12f4 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -1,98 +1,98 @@ -'use strict' -import path from 'path' -import { cmdArg } from './services/cmdParse' -const { app, protocol } = require('electron') -import PersistedState from 'vuex-electron-store' -import initWindow from './services/windowManager' -import DisableButton from './config/DisableButton' -const { session } = require('electron') -// import electronDevtoolsInstaller, { -// VUEJS_DEVTOOLS -// } from 'electron-devtools-installer'; -import { NO_CACHE_FILE_PROTOCOL } from '@/constants' - -protocol.registerSchemesAsPrivileged([ - { - scheme: NO_CACHE_FILE_PROTOCOL, - privileges: { bypassCSP: true } - } -]) -// app.disableHardwareAcceleration(); // 禁用gpu加速 解决图片拖动卡顿问题 -if (cmdArg.h) { - console.log(` -MegSpot支持linux命令启动方便用户快捷访问。可以通过参数快捷进入图片视频的文件选取和比较页面。 -Detail: https://github.com/MegEngine/MegSpot/wiki/%E5%91%BD%E4%BB%A4%E8%A1%8C%E6%93%8D%E4%BD%9C - -usage: -./MegSpot-x.x.x.AppImage [folderPath] [-ivch] 进入文件选取页面,并浏览folderPath文件夹地址 -./MegSpot-x.x.x.AppImage [filePath ...] [-ivch] 进入文件对比页面,可以同时添加多个 - -Options: - path 支持绝对/相关的文件/文件夹地址,如果地址不存在则会被忽略 - -h, --help 进入帮助说明 - -i, --image 进入图片相关页面 - -v, --video 进入视频相关页面 - -c, --clear 清空已选 - -advise: - 由于MegSpot支持自动更新导致 MegSpot-x.x.x.AppImage的文件名称会不断变化,建议创建个硬链接指向AppImage - 命令:sudo ln ./MegSpot-x.x.x.AppImage /usr/bin/MegSpot - `) - app.exit() -} -app.commandLine.appendSwitch('enable-features', 'PlatformHEVCDecoderSupport') // 启用H.265解码 -require('@electron/remote/main').initialize() // init @electron/remote -PersistedState.initRenderer() // init vuex-electron-store -console.log('cmdArg', cmdArg) -function onAppReady() { - initWindow() - DisableButton.Disablef12() - if (process.env.NODE_ENV === 'development') { - const { VUEJS_DEVTOOLS } = require('electron-devtools-vendor') // Vue2 Extension - session.defaultSession - .loadExtension(path.resolve(VUEJS_DEVTOOLS), { - allowFileAccess: true - }) - .then(() => { - console.log('已安装: vue-devtools') - }) - .catch((err) => { - console.error('拓展安装失败', err) - }) - // electronDevtoolsInstaller(VUEJS_DEVTOOLS) - // .then(name => console.log(`installed: ${name}`)) - // .catch(err => console.log('Unable to install `vue-devtools`: \n', err)); - } - const registerSucceed = protocol.registerFileProtocol(NO_CACHE_FILE_PROTOCOL, (request, callback) => { - const url = decodeURI(request.url).substr(`${NO_CACHE_FILE_PROTOCOL}://`.length) - callback({ - path: url, - headers: { - 'cache-control': 'no-store' - } - }) - }) - if (!registerSucceed) console.error('Failed to register protocol') - // protocol.interceptFileProtocol('file', (request, callback) => { - // callback(request) - // }) -} -// 禁止缓存 -app.isReady() ? onAppReady() : app.on('ready', onAppReady) -// 解决9.x跨域异常问题 -app.commandLine.appendArgument('no-sandbox') - -app.on('window-all-closed', () => { - // 所有平台均为所有窗口关闭就退出软件 - app.quit() -}) -app.on('browser-window-created', () => { - // console.log('window-created'); -}) -const MEGSPOT = 'megspot' -if (process.env.NODE_ENV === 'development' && process.platform === 'win32') { - // 设置electron.exe 和 app的路径 - app.setAsDefaultProtocolClient(MEGSPOT, process.execPath, [path.resolve(process.argv[1])]) -} else { - app.setAsDefaultProtocolClient(MEGSPOT) -} +'use strict' +import path from 'path' +import { cmdArg } from './services/cmdParse' +const { app, protocol } = require('electron') +import PersistedState from 'vuex-electron-store' +import initWindow from './services/windowManager' +import DisableButton from './config/DisableButton' +const { session } = require('electron') +// import electronDevtoolsInstaller, { +// VUEJS_DEVTOOLS +// } from 'electron-devtools-installer'; +import { NO_CACHE_FILE_PROTOCOL } from '@/constants' + +protocol.registerSchemesAsPrivileged([ + { + scheme: NO_CACHE_FILE_PROTOCOL, + privileges: { bypassCSP: true } + } +]) +// app.disableHardwareAcceleration(); // 禁用gpu加速 解决图片拖动卡顿问题 +if (cmdArg.h) { + console.log(` +MegSpot支持linux命令启动方便用户快捷访问。可以通过参数快捷进入图片视频的文件选取和比较页面。 +Detail: https://github.com/MegEngine/MegSpot/wiki/%E5%91%BD%E4%BB%A4%E8%A1%8C%E6%93%8D%E4%BD%9C + +usage: +./MegSpot-x.x.x.AppImage [folderPath] [-ivch] 进入文件选取页面,并浏览folderPath文件夹地址 +./MegSpot-x.x.x.AppImage [filePath ...] [-ivch] 进入文件对比页面,可以同时添加多个 + +Options: + path 支持绝对/相关的文件/文件夹地址,如果地址不存在则会被忽略 + -h, --help 进入帮助说明 + -i, --image 进入图片相关页面 + -v, --video 进入视频相关页面 + -c, --clear 清空已选 + +advise: + 由于MegSpot支持自动更新导致 MegSpot-x.x.x.AppImage的文件名称会不断变化,建议创建个硬链接指向AppImage + 命令:sudo ln ./MegSpot-x.x.x.AppImage /usr/bin/MegSpot + `) + app.exit() +} +app.commandLine.appendSwitch('enable-features', 'PlatformHEVCDecoderSupport') // 启用H.265解码 +require('@electron/remote/main').initialize() // init @electron/remote +PersistedState.initRenderer() // init vuex-electron-store +console.log('cmdArg', cmdArg) +function onAppReady() { + initWindow() + DisableButton.Disablef12() + if (process.env.NODE_ENV === 'development') { + const { VUEJS_DEVTOOLS } = require('electron-devtools-vendor') // Vue2 Extension + session.defaultSession + .loadExtension(path.resolve(VUEJS_DEVTOOLS), { + allowFileAccess: true + }) + .then(() => { + console.log('已安装: vue-devtools') + }) + .catch((err) => { + console.error('拓展安装失败', err) + }) + // electronDevtoolsInstaller(VUEJS_DEVTOOLS) + // .then(name => console.log(`installed: ${name}`)) + // .catch(err => console.log('Unable to install `vue-devtools`: \n', err)); + } + const registerSucceed = protocol.registerFileProtocol(NO_CACHE_FILE_PROTOCOL, (request, callback) => { + const url = decodeURI(request.url).substr(`${NO_CACHE_FILE_PROTOCOL}://`.length) + callback({ + path: url, + headers: { + 'cache-control': 'no-store' + } + }) + }) + if (!registerSucceed) console.error('Failed to register protocol') + // protocol.interceptFileProtocol('file', (request, callback) => { + // callback(request) + // }) +} +// 禁止缓存 +app.isReady() ? onAppReady() : app.on('ready', onAppReady) +// 解决9.x跨域异常问题 +app.commandLine.appendArgument('no-sandbox') + +app.on('window-all-closed', () => { + // 所有平台均为所有窗口关闭就退出软件 + app.quit() +}) +app.on('browser-window-created', () => { + // console.log('window-created'); +}) +const MEGSPOT = 'megspot' +if (process.env.NODE_ENV === 'development' && process.platform === 'win32') { + // 设置electron.exe 和 app的路径 + app.setAsDefaultProtocolClient(MEGSPOT, process.execPath, [path.resolve(process.argv[1])]) +} else { + app.setAsDefaultProtocolClient(MEGSPOT) +} diff --git a/src/renderer/views/image/components/ImageCanvas.vue b/src/renderer/views/image/components/ImageCanvas.vue index 46b6598..d7dfec1 100644 --- a/src/renderer/views/image/components/ImageCanvas.vue +++ b/src/renderer/views/image/components/ImageCanvas.vue @@ -1,1248 +1,1267 @@ - - - + + +