Skip to content

Commit cb3e32f

Browse files
committed
dumili: wip
1 parent c776c4c commit cb3e32f

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

apps/dumili/src/pages/indexation/[id].vue

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<b-row v-if="indexationId && hasData" class="d-flex h-100">
3-
<b-col :cols="6">
3+
<b-col :cols="6" class="d-flex flex-column h-100">
44
<template v-if="tabNames[activeTab] === 'Page gallery'"
55
><Gallery :images="images" />
66
<upload-widget
@@ -24,7 +24,6 @@
2424
ref="bookComponent"
2525
v-model:book="book"
2626
v-model:current-page="bookCurrentPage"
27-
:cover-height="coverHeight"
2827
:cover-ratio="coverRatio"
2928
:urls="indexation!.pages.map(({ url }) => url)"
3029
:with-table-of-contents="false" />
@@ -58,11 +57,7 @@ const { Book } = webComponents;
5857
5958
const book = ref<PageFlip | undefined>(undefined);
6059
const bookCurrentPage = ref(0);
61-
const coverWidth = ref(1000);
6260
const coverRatio = ref<number | undefined>(undefined);
63-
const coverHeight = computed(
64-
() => coverRatio.value && coverWidth.value * coverRatio.value,
65-
);
6661
6762
const showUploadWidget = ref(false);
6863
const route = useRoute();
@@ -135,7 +130,6 @@ watch(
135130
"https://res.cloudinary.com/dl7hskxab/image/upload/pg_1/fl_getinfo/v1729876637/dumili/brunoperel/20241025T171702824/Picsou_magazine_529_11zon_krzady.png",
136131
)
137132
).json();
138-
debugger;
139133
coverRatio.value =
140134
firstPageDimensions.output.height / firstPageDimensions.output.width;
141135
hasData.value = true;

apps/web/src/components/Book.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="container" @click.self="closeBook()">
2+
<div ref="container" class="container flex-grow-1" @click.self="closeBook()">
33
<div id="book" class="flip-book" @click.self="closeBook()">
44
<slot name="table-of-contents" />
55

@@ -32,7 +32,7 @@ import { PageFlip } from "page-flip";
3232
const { urls, edgeWidth, coverRatio, coverHeight } = defineProps<{
3333
urls: string[];
3434
edgeWidth?: number;
35-
coverRatio?: number;
35+
coverRatio: number;
3636
coverHeight?: number;
3737
}>();
3838
const emit = defineEmits<{ (e: "close-book"): void }>();
@@ -41,6 +41,8 @@ const slots = defineSlots<{
4141
"table-of-contents"(): unknown;
4242
}>();
4343
44+
const container = ref<HTMLElement>();
45+
4446
const book = defineModel<PageFlip | undefined>("book");
4547
const opened = defineModel<boolean>("opened", { default: false });
4648
const opening = defineModel<boolean>("opening", { default: false });
@@ -73,12 +75,11 @@ onMounted(() => {
7375
watch(
7476
isReadyToOpen,
7577
(newValue) => {
76-
if (newValue && coverRatio && coverHeight) {
77-
const bookElement: HTMLElement = document.getElementById("book")!;
78-
const height = coverHeight || bookElement.clientHeight;
79-
const width = height / coverRatio / 2;
80-
book.value = new PageFlip(bookElement, {
81-
width,
78+
if (newValue && coverRatio) {
79+
const height = coverHeight || container.value!.clientHeight;
80+
debugger;
81+
book.value = new PageFlip(document.getElementById("book")!, {
82+
width: height / coverRatio,
8283
height,
8384
8485
maxShadowOpacity: 0.5,

0 commit comments

Comments
 (0)