Skip to content

Commit edc2595

Browse files
committed
[dumili] Fix detection debugging boxes calculation
1 parent 070408d commit edc2595

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

apps/dumili/src/components/Book.vue

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
v-if="
3535
showAiDetections !== undefined &&
3636
xOffset !== undefined &&
37-
displayRatio &&
37+
displayRatioNoCropping &&
3838
aiDetails[url].panels?.length
3939
"
4040
class="position-absolute h-100"
@@ -50,10 +50,10 @@
5050
:key="`ocr-match-${idx}`"
5151
class="position-absolute ocr-match panel"
5252
:style="{
53-
left: `${x * displayRatio}px`,
54-
top: `${y * displayRatio}px`,
55-
width: `${width * displayRatio}px`,
56-
height: `${height * displayRatio}px`,
53+
left: `${x * displayRatioNoCropping}px`,
54+
top: `${y * displayRatioNoCropping}px`,
55+
width: `${width * displayRatioNoCropping}px`,
56+
height: `${height * displayRatioNoCropping}px`,
5757
}"
5858
></div>
5959
<div
@@ -178,29 +178,32 @@ const releaseDate = computed(() => {
178178
});
179179
180180
const displayedWidth = computed(() => book.value?.getSettings().width);
181+
const displayedHeight = computed(() => book.value?.getSettings().height);
181182
182183
const xOffset = computed(
183184
() =>
185+
displayedHeight.value &&
186+
pageRatio.value &&
184187
displayedWidth.value &&
185-
displayRatio.value &&
186-
coverWidth.value &&
187-
(displayedWidth.value - coverWidth.value * displayRatio.value) / 2
188+
(displayedWidth.value - displayedHeight.value * pageRatio.value) / 2
188189
);
189190
190-
const displayRatio = computed(
191+
const pageRatio = computed(() => coverWidth.value! / coverHeight.value!);
192+
193+
const displayRatioNoCropping = computed(
191194
() =>
192-
displayedWidth.value &&
195+
displayedHeight.value &&
193196
coverHeight.value &&
194-
displayedWidth.value / coverHeight.value
197+
displayedHeight.value / coverHeight.value
195198
);
196199
197200
const firstPanelPosition = (url: string) => {
198201
const { bbox } = aiDetails.value[url].panels[0];
199202
return {
200-
left: bbox.x * displayRatio.value!,
201-
top: bbox.y * displayRatio.value!,
202-
width: bbox.width * displayRatio.value!,
203-
height: bbox.height * displayRatio.value!,
203+
left: bbox.x * displayRatioNoCropping.value!,
204+
top: bbox.y * displayRatioNoCropping.value!,
205+
width: bbox.width * displayRatioNoCropping.value!,
206+
height: bbox.height * displayRatioNoCropping.value!,
204207
};
205208
};
206209

packages/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"~prisma-clients": "../prisma-clients"
1212
},
1313
"dependencies": {
14-
"@prisma/client": "^5.2.0",
14+
"@prisma/client": "^5.3.1",
1515
"@pusher/push-notifications-server": "^1.2.6",
1616
"@sentry/node": "^7.68.0",
1717
"axios": "^1.5.0",

packages/prisma-clients/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"build": "ls schemas/*.prisma | while read -r schema; do pnpx prisma generate --schema=$schema; done && rm -rf dist && ./node_modules/.pnpm/node_modules/.bin/tsc"
88
},
99
"dependencies": {
10-
"@prisma/client": "5.2.0",
10+
"@prisma/client": "^5.3.1",
1111
"prisma": "^5.2.0",
1212
"ts-node": "^10.9.1"
1313
}

pnpm-lock.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)