scroll on preview image

pull/150/merge^2
iozeey 2 years ago
parent 0c8ffa04c3
commit 318e4d7fae

@ -80,7 +80,7 @@
:editable="editable" :editable="editable"
:template="template" :template="template"
:is-direct-upload="isDirectUpload" :is-direct-upload="isDirectUpload"
@scroll-to="scrollIntoDocument(item)" @scroll-to="scrollIntoDocument"
@remove="onDocumentRemove" @remove="onDocumentRemove"
@replace="onDocumentReplace" @replace="onDocumentReplace"
@up="moveDocument(item, -1)" @up="moveDocument(item, -1)"
@ -448,10 +448,10 @@ export default {
this.documentRefs.push(el) this.documentRefs.push(el)
} }
}, },
scrollIntoDocument (item) { scrollIntoDocument (item, page) {
const ref = this.documentRefs.find((e) => e.document.uuid === item.attachment_uuid) const documentRef = this.documentRefs.find((e) => e.document.uuid === item.attachment_uuid)
documentRef.scrollIntoDocument(page)
ref.$el.scrollIntoView({ behavior: 'smooth', block: 'start' }) // pageRef.$el.scrollIntoView({ behavior: 'smooth', block: 'start' })
}, },
onKeyUp (e) { onKeyUp (e) {
if (e.code === 'Escape') { if (e.code === 'Escape') {

@ -91,6 +91,10 @@ export default {
scrollToArea (area) { scrollToArea (area) {
this.pageRefs[area.page].areaRefs.find((e) => e.area === area).$el.scrollIntoView({ behavior: 'smooth', block: 'center' }) this.pageRefs[area.page].areaRefs.find((e) => e.area === area).$el.scrollIntoView({ behavior: 'smooth', block: 'center' })
}, },
scrollIntoDocument (page) {
const ref = this.pageRefs.find((e) => e.image.uuid === page.uuid)
ref.$el.scrollIntoView({ behavior: 'smooth', block: 'start' })
},
setPageRefs (el) { setPageRefs (el) {
if (el) { if (el) {
this.pageRefs.push(el) this.pageRefs.push(el)

@ -13,7 +13,7 @@
</div> </div>
<div <div
class="group flex justify-end cursor-pointer top-0 bottom-0 left-0 right-0 absolute p-1" class="group flex justify-end cursor-pointer top-0 bottom-0 left-0 right-0 absolute p-1"
@click="$emit('scroll-to', item)" @click="$emit('scroll-to', item, previewImage)"
> >
<div <div
v-if="editable && index==0" v-if="editable && index==0"

Loading…
Cancel
Save