Skip to content

Commit

Permalink
release: v2.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
hjwforever committed Aug 11, 2023
1 parent dacbdf8 commit 092d337
Show file tree
Hide file tree
Showing 14 changed files with 388 additions and 26 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- [文件选择](https://github.com/MegEngine/MegSpot/wiki/文件选择)
- [文件列表](https://github.com/MegEngine/MegSpot/wiki/文件列表)
- [文件长廊](https://github.com/MegEngine/MegSpot/wiki/文件长廊)
- [RGB Viewer](https://github.com/MegEngine/MegSpot/wiki/RGB-Viewer)
- [命令行操作](https://github.com/MegEngine/MegSpot/wiki/命令行操作)
- [多语言支持](https://github.com/MegEngine/MegSpot/wiki/语言支持)
- [帮助视频](https://github.com/MegEngine/MegSpot/wiki/帮助视频)
Expand Down
1 change: 1 addition & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ English | [中文](README.md)
- Mac, Linux, Window cross-platform support & automatic update support.
- **HEVC/H.265 video hard decoding support**.
- Support the comparison of any screen of multiple videos.
- [RGB Viewer](https://github.com/MegEngine/MegSpot/wiki/RGB-Viewer)
- Support terminal command.
- Support multiple languages: Chinese, English, Japanese.

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MegSpot",
"version": "v2.2.3",
"version": "v2.2.4",
"author": "weiyajun <weiyajun@megvii.com>",
"description": "A tool to improve the viewing of pictures and videos by researchers",
"homepage": "https://github.com/MegEngine/MegSpot",
Expand Down Expand Up @@ -44,8 +44,8 @@
"appId": "org.megvii.megspot",
"copyright": " Copyright (c) 2022 Megvii Inc. All rights reserved.",
"releaseInfo": {
"releaseNotes": "一、 新增功能:\n 1. 图像及视频都支持多序列,并可进行不同序列之间的对比;\n 2. 取色器的色值支持rgb及hex两种显示格式,可在设置中更改; \n二. 优化体验:\n 更新工具栏ui;同步上线相关更新的翻译。 \n三. 修复问题:\n 1. 修复某些图像不能正确同步地缩放的问题;\n 2. 修复快照模式布局未正常加载的问题;",
"releaseDate": "2023.5.14"
"releaseNotes": "新增功能:\n 1. 支持RGB Viewer模式,显示每个像素块的RGB值,图像对比及视频对比(暂停时)均可用;\n 2. 取色器支持显示鼠标x、y坐标信息,可在设置中手动启用/关闭;",
"releaseDate": "2023.08.11"
},
"directories": {
"output": "build"
Expand Down
50 changes: 50 additions & 0 deletions src/renderer/components/RGBTextBtn/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<template>
<div
:class="['rgb-text-btn', showRGBText ? 'active' : '']"
:title="$t('hotkey.rgbText') + `\n${$t('hotkey.key')}: 'c'`"
@click="toggleShowRGBText"
>
RGB
</div>
</template>

<script>
import { createNamespacedHelpers } from 'vuex'
const { mapGetters, mapActions } = createNamespacedHelpers('preferenceStore')
export default {
computed: {
...mapGetters(['preference']),
showRGBText: {
get() {
return this.preference.showRGBText // false
},
set(newVal) {
this.setPreference({ showRGBText: newVal })
}
}
},
methods: {
...mapActions(['setPreference']),
toggleShowRGBText() {
this.showRGBText = !this.showRGBText
}
}
}
</script>

<style lang="scss" scoped>
@import '@/styles/variables.scss';
.rgb-text-btn {
border: 1px solid #707078;
border-radius: 5px;
color: #707078;
&:hover {
cursor: pointer;
}
}
.rgb-text-btn.active {
border: 1px solid $primaryColor;
color: $primaryColor;
}
</style>
3 changes: 2 additions & 1 deletion src/renderer/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export default {
moveLeft: 'move left',
moveRight: 'move right',
moveDown: 'move downward',
pickColor: 'Turn on/off the color picker'
pickColor: 'Turn on/off the color picker',
rgbText: 'Enable/disable the display of RGB values in each pixel block'
},
dashboard: {
entries: {
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/lang/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export default {
moveLeft: '左に移動',
moveRight: '向右移动',
moveDown: '下に移動',
pickColor: 'カラーピッカーのオン/オフを切り替えます'
pickColor: 'カラーピッカーのオン/オフを切り替えます',
rgbText: '各ピクセルブロックのRGB値の表示を有効/無効にします。'
},
dashboard: {
entries: {
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export default {
moveLeft: '向左移动',
moveRight: '向右移动',
moveDown: '向下移动',
pickColor: '打开/关闭取色器'
pickColor: '打开/关闭取色器',
rgbText: '启用/关闭RGB数值在每个像素块中的显示'
},
dashboard: {
entries: {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/store/modules/preferenceStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const preferenceStore = {
colorPickerMode: 'rgb', // `rgb` / `hex`
// 取色器中是否显示鼠标坐标
colorPickerShowPos: true,
showRGBText: false,
// 每次手动按键时图像的移动距离, 默认为100像素
moveDistance: 100,
// 视频控制条位置 fixed(固定在toolbar) / float (悬浮球)
Expand Down
5 changes: 5 additions & 0 deletions src/renderer/tools/hotkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ export const DEFAULT_HOTKEYS = [
name: 'right',
desc: 'compare to right',
keysArr: [['ArrowRight']]
},
{
name: 'rgbText',
desc: 'display RGB values in pixel blocks',
keysArr: [['c']]
}
].map((item, index) => {
item.index = index
Expand Down
39 changes: 39 additions & 0 deletions src/renderer/utils/canvas.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { clamp } from "./index"

export const DEFAULT_OVERLAP_RECT_OPTIONS = { padding: 0, round: false }
function getOverlapRect(rect1, rect2, options = {}) {
const { padding, round } = Object.assign({}, DEFAULT_OVERLAP_RECT_OPTIONS, options)
let x1 = Math.max(rect1.x, rect2.x)
let y1 = Math.max(rect1.y, rect2.y)
let x2 = Math.min(rect1.x + rect1.width, rect2.x + rect2.width)
let y2 = Math.min(rect1.y + rect1.height, rect2.y + rect2.height)

if (round) {
x1 = Math.ceil(x1)
y1 = Math.ceil(y1)
x2 = Math.floor(x2)
y2 = Math.floor(y2)
}

if (padding !== 0) {
x1 -= padding
y1 -= padding
x2 += padding
y2 += padding
}

// if (round || padding !== 0) {
// x1 = clamp(x1, Math.min())
// y1 = padding
// x2 = padding
// y2 = padding
// }

if (x2 > x1 && y2 > y1) {
return { x: x1, y: y1, width: x2 - x1, height: y2 - y1 }
} else {
return null
}
}

export { getOverlapRect }
10 changes: 8 additions & 2 deletions src/renderer/views/image/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<el-radio-button :label="false">{{ $t('imageCenter.nearestInterpolation') }}</el-radio-button>
<el-radio-button :label="true">{{ $t('imageCenter.bilinearInterpolation') }}</el-radio-button>
</el-radio-group>
<RGBTextBtn class="gap" />
<el-button
v-if="snapshotMode"
type="text"
Expand Down Expand Up @@ -211,13 +212,14 @@ import SelectedBtn from '@/components/selected-btn'
import { createNamespacedHelpers } from 'vuex'
import GifDialog from '@/components/gif-dialog'
import ImageSetting from '@/components/image-setting'
import RGBTextBtn from '@//components/RGBTextBtn'
const { mapGetters, mapActions } = createNamespacedHelpers('imageStore')
const { mapGetters: preferenceMapGetters } = createNamespacedHelpers('preferenceStore')
const { mapGetters: preferenceMapGetters, mapActions: preferenceMapActions } = createNamespacedHelpers('preferenceStore')
import { throttle } from '@/utils'
import { handleEvent } from '@/tools/hotkey'
export default {
components: { SelectedBtn, GifDialog, ImageSetting },
components: { SelectedBtn, GifDialog, ImageSetting, RGBTextBtn },
props: {
snapshotMode: {
type: Boolean,
Expand Down Expand Up @@ -275,6 +277,7 @@ export default {
},
methods: {
...mapActions(['emptyImages', 'removeImages', 'setImageConfig', 'setImages']),
...preferenceMapActions(['setPreference']),
initHotkeyEvents() {
const hotkeyDownEvents = new Map()
const hotkeyUpEvents = new Map()
Expand Down Expand Up @@ -333,6 +336,9 @@ export default {
this.changeGroup(this.groupNum, this.groupNum - 1)
}
})
hotkeyDownEvents.set('rgbText', () => {
this.setPreference({ showRGBText: !this.preference.showRGBText })
})
hotkeyUpEvents.set('top', () => {
this.cancelOverlay(GLOBAL_CONSTANTS.DIRECTION_TOP)
Expand Down
Loading

0 comments on commit 092d337

Please sign in to comment.