Skip to content

Commit

Permalink
fix: 修复等效焦距不存在时,参数显示异常
Browse files Browse the repository at this point in the history
fix: 修复上传字体后,字体选择异常
  • Loading branch information
云中君 committed Mar 26, 2024
1 parent 0e34c79 commit 131683f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion electron/main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default class Application {

private async createDefWin() {
const opts: BrowserWindowConstructorOptions = {
width: 700 + (isDev ? 500 : 0),
width: 800 + (isDev ? 500 : 0),
height: 610,
title: '壹印',
frame: false,
Expand Down
4 changes: 2 additions & 2 deletions electron/src/modules/exiftool/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ export class ExifTool {
Model: record.CameraModelName || '',
LensMake: record.LensMake || '',
LensModel: record.LensModel || '',
FNumber: record.FNumber || '',
FNumber: record.FNumber.split('.')[0] || '',
ISO: record.ISO || '',
FocalLength: record.FocalLength?.split('.')[0] || '',
FocalLengthIn35mmFormat: record.FocalLengthIn35mmFormat?.split(' ')[0] || '',
FocalLengthIn35mmFormat: record.FocalLengthIn35mmFormat?.split(' ')[0] || record.FocalLength?.split('.')[0] || '',
ExposureTime: record.ExposureTime || '',
DateTimeOriginal: record.DateTimeOriginal || '',
ExposureCompensation: record.ExposureCompensation || '',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yiyin",
"version": "1.5.0",
"version": "1.5.1",
"license": "MIT",
"type": "module",
"main": "dist-electron/main/index.js",
Expand Down
1 change: 1 addition & 0 deletions web/components/font-select/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
}

.db-select-dropdown {
width: 180px !important;
background-color: var(--bg-color);

.db-select-dropdown__item {
Expand Down
8 changes: 6 additions & 2 deletions web/components/font-select/index.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import { arrToObj } from '@common/utils';
import { FontDialog } from '@components';
import { Message, Option, Select } from '@ggchivalrous/db-ui';
import frederickathegreat from '@web/assets/font/FrederickatheGreat.ttf';
Expand All @@ -13,6 +14,7 @@
export let value = '';
export let clearable = false;
const dispatch = createEventDispatcher();
const defActiveFont = { name: 'PingFang SC', fileName: '' };
const defFont = [
defActiveFont,
Expand All @@ -21,7 +23,7 @@
{ name: 'FrederickatheGreat', fileName: frederickathegreat },
{ name: 'Neoneon', fileName: neoneon },
];
const dispatch = createEventDispatcher();
const defFontRecord = arrToObj(defFont, 'name');
let fontList = [...defFont];
let visible = false;
Expand Down Expand Up @@ -63,7 +65,9 @@
}
fontList = [...defFont, ...list];
if ((!_fontMap[value] && value !== defActiveFont.name) || !value) {
// 选择的字体已经被删除了,则改为默认字体
if ((!_fontMap[value] && !defFontRecord[value]) || !value) {
value = defActiveFont.name;
}
}
Expand Down
16 changes: 6 additions & 10 deletions web/modules/text-tool/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ export class TextTool {

if (fieldTemp.type === 'text') {
slotInfo.value = `${fieldTemp.value}`.trim();
if (slotInfo.value) {
slotInfoList.push(slotInfo);
}
slotInfoList.push(slotInfo.value ? slotInfo : '');
continue;
}

Expand All @@ -70,23 +68,21 @@ export class TextTool {
slotInfo.value = await loadImage(fieldTemp.wImg);
}

if (slotInfo.value) {
slotInfoList.push(slotInfo);
}
slotInfoList.push(slotInfo.value ? slotInfo : '');
}

const _arr = text.trim().split('{---}');

if (
(_arr.length === 1 && !_arr[0].trim())
|| (_arr.length > 1 && !slotInfoList.length)
|| (_arr.length > 1 && !slotInfoList.filter(Boolean).length)
) continue;

for (let j = 0; j < _arr.length; j++) {
if (slotInfoList[j]?.value) {
textList.push(_arr[j], slotInfoList[j]);
} else {
if (typeof slotInfoList[j] === 'string' || !(slotInfoList[j] as any)?.value) {
textList.push(_arr[j]);
} else {
textList.push(_arr[j], slotInfoList[j]);
}
}
} else {
Expand Down

0 comments on commit 131683f

Please sign in to comment.