diff --git a/src/components/lists/ShotList.vue b/src/components/lists/ShotList.vue index 4dc421dd9b..76e58cb533 100644 --- a/src/components/lists/ShotList.vue +++ b/src/components/lists/ShotList.vue @@ -249,6 +249,8 @@ @@ -805,10 +807,30 @@ export default { timeSpent: true }, offsets: {}, - stickedColumns: {} + stickedColumns: {}, + domEvents: [ + ['mousemove', this.onMouseMove], + ['touchmove', this.onMouseMove], + ['mouseup', this.stopBrowsing], + ['mouseleave', this.stopBrowsing], + ['touchend', this.stopBrowsing], + ['touchcancel', this.stopBrowsing], + ['keyup', this.stopBrowsing] + ] } }, + mounted() { + this.stickedColumns = + JSON.parse(localStorage.getItem(this.localStorageStickKey)) || {} + this.addEvents(this.domEvents) + }, + + beforeUnmount() { + this.removeEvents(this.domEvents) + document.body.style.cursor = 'default' + }, + computed: { ...mapGetters([ 'currentProduction', @@ -1144,11 +1166,6 @@ export default { isBigThumbnails() { this.updateOffsets() } - }, - - mounted() { - this.stickedColumns = - JSON.parse(localStorage.getItem(this.localStorageStickKey)) || {} } } diff --git a/src/components/mixins/entity_list.js b/src/components/mixins/entity_list.js index 336444fd13..3cf246bd89 100644 --- a/src/components/mixins/entity_list.js +++ b/src/components/mixins/entity_list.js @@ -545,6 +545,59 @@ export const entityListMixin = { }) } } + }, + + startBrowsing(event) { + document.body.style.cursor = 'grabbing' + this.isBrowsingX = true + this.isBrowsingY = true + this.initialClientX = this.getClientX(event) + this.initialClientY = this.getClientY(event) + }, + + startBrowsingX(event) { + document.body.style.cursor = 'grabbing' + this.isBrowsingX = true + this.initialClientX = this.getClientX(event) + }, + + startBrowsingY(event) { + document.body.style.cursor = 'grabbing' + this.isBrowsingY = true + this.initialClientY = this.getClientY(event) + }, + + stopBrowsing(event) { + document.body.style.cursor = 'default' + this.isBrowsingX = false + this.isBrowsingY = false + this.initialClientX = null + this.initialClientY = null + }, + + onMouseMove(event) { + if (this.isBrowsingX) this.scrollTableLeft(event) + if (this.isBrowsingY) this.scrollTableTop(event) + }, + + scrollTableLeft(event) { + const tableWrapper = this.$refs.body + const previousLeft = tableWrapper.scrollLeft + const movementX = + event.movementX || this.getClientX(event) - this.initialClientX + const newLeft = previousLeft - movementX + this.initialClientX = this.getClientX(event) + tableWrapper.scrollLeft = newLeft + }, + + scrollTableTop(event) { + const tableWrapper = this.$refs.body + const previousTop = tableWrapper.scrollTop + const movementY = + event.movementY || this.getClientY(event) - this.initialClientY + const newTop = previousTop - movementY + this.initialClientY = this.getClientY(event) + tableWrapper.scrollTop = newTop } }, diff --git a/src/components/pages/playlists/PlaylistPlayer.vue b/src/components/pages/playlists/PlaylistPlayer.vue index 9ea1e3bd69..d3d3068b50 100644 --- a/src/components/pages/playlists/PlaylistPlayer.vue +++ b/src/components/pages/playlists/PlaylistPlayer.vue @@ -256,7 +256,7 @@ }" v-show="isCurrentPreviewPicture && !isLoading" > - @@ -959,10 +963,11 @@ import ColorPicker from '@/components/widgets/ColorPicker.vue' import Combobox from '@/components/widgets/Combobox.vue' import ComboboxStyled from '@/components/widgets/ComboboxStyled.vue' import DeleteModal from '@/components/modals/DeleteModal.vue' +import MultiPictureViewer from '@/components/previews/MultiPictureViewer.vue' import ObjectViewer from '@/components/previews/ObjectViewer.vue' import PencilPicker from '@/components/widgets/PencilPicker.vue' -import PictureViewer from '@/components/previews/PictureViewer.vue' import PlaylistedEntity from '@/components/pages/playlists/PlaylistedEntity.vue' +import PictureViewer from '@/components/previews/PictureViewer.vue' import RawVideoPlayer from '@/components/pages/playlists/RawVideoPlayer.vue' import PreviewRoom from '@/components/widgets/PreviewRoom.vue' import SelectTaskTypeModal from '@/components/modals/SelectTaskTypeModal.vue' @@ -988,6 +993,7 @@ export default { ObjectViewer, PencilPicker, PictureViewer, + MultiPictureViewer, PlayIcon, PlaylistedEntity, PreviewRoom, @@ -1146,6 +1152,31 @@ export default { return this.$refs['full-playlist-player'] }, + picturePreviews() { + const picturePreviews = [] + this.entityList.forEach(e => { + picturePreviews.push({ + id: e.preview_file_id, + height: e.preview_file_height, + width: e.preview_file_width, + extension: e.preview_file_extension, + revision: e.preview_file_revision, + position: 1 + }) + e.preview_file_previews.forEach((p, index) => { + picturePreviews.push({ + id: p.id, + height: p.height, + width: p.width, + extension: p.extension, + revision: p.revision, + position: index + 2 + }) + }) + }) + return picturePreviews + }, + isMovieComparison() { if (!this.currentPreviewToCompare) return false return this.currentPreviewToCompare.extension === 'mp4' diff --git a/src/components/pages/playlists/RawVideoPlayer.vue b/src/components/pages/playlists/RawVideoPlayer.vue index 12864c51b4..31ccbb8253 100644 --- a/src/components/pages/playlists/RawVideoPlayer.vue +++ b/src/components/pages/playlists/RawVideoPlayer.vue @@ -337,8 +337,16 @@ export default { ) const rate = this.$options.rate || 1 - this.currentPlayer.src = this.getMoviePath(entity) - this.nextPlayer.src = this.getMoviePath(nextEntity) + if (entity.preview_file_extension === 'mp4' && this.currentPlayer) { + this.currentPlayer.src = this.getMoviePath(entity) + } else if (this.currentPlayer) { + this.currentPlayer.src = '' + } + if (nextEntity.preview_file_extension === 'mp4' && this.nextPlayer) { + this.nextPlayer.src = this.getMoviePath(nextEntity) + } else if (this.nextPlayer) { + this.nextPlayer.src = '' + } this.currentPlayer.style.display = 'block' this.nextPlayer.style.display = 'none' this.resetHeight() diff --git a/src/components/previews/MultiPictureViewer.vue b/src/components/previews/MultiPictureViewer.vue new file mode 100644 index 0000000000..6955088da9 --- /dev/null +++ b/src/components/previews/MultiPictureViewer.vue @@ -0,0 +1,239 @@ + + + + + diff --git a/src/components/previews/PictureViewer.vue b/src/components/previews/PictureViewer.vue index 724b1995a3..5df7a0ba78 100644 --- a/src/components/previews/PictureViewer.vue +++ b/src/components/previews/PictureViewer.vue @@ -100,8 +100,16 @@ export default { }, mounted() { + this.container = this.$refs.container + this.picture = this.$refs.picture + this.pictureBig = this.$refs['picture-big'] + this.pictureGif = this.$refs['picture-gif'] + this.pictureWrapper = this.$refs['picture-wrapper'] + this.pictureSubWrapper = this.$refs['picture-subwrapper'] + this.container.style.height = this.defaultHeight + 'px' this.isLoading = true + this.setPictureEmptyPath() if (this.picture.complete) { this.onWindowResize() @@ -133,30 +141,6 @@ export default { computed: { // Elements - container() { - return this.$refs.container - }, - - picture() { - return this.$refs.picture - }, - - pictureBig() { - return this.$refs['picture-big'] - }, - - pictureGif() { - return this.$refs['picture-gif'] - }, - - pictureWrapper() { - return this.$refs['picture-wrapper'] - }, - - pictureSubWrapper() { - return this.$refs['picture-subwrapper'] - }, - status() { return this.preview && this.preview.status ? this.preview.status : 'ready' }, @@ -219,7 +203,10 @@ export default { const dimensions = this.getNaturalDimensions() if (dimensions.width > 0) ratio = dimensions.height / dimensions.width let width = dimensions.width - if (width > this.container.offsetWidth) { + if ( + width > this.container.offsetWidth && + this.container.offsetWidth > 0 + ) { width = this.container.offsetWidth } let height = Math.floor(width * ratio) @@ -237,6 +224,9 @@ export default { // Configuration endLoading() { + if (!this.picture) { + this.picture = this.$refs.picture + } if ( this.fullScreen && (this.pictureBig.complete || this.pictureGif.complete) @@ -256,6 +246,7 @@ export default { if (this.pictureSubWrapper) { this.pictureWrapper.style['max-height'] = heightValue this.pictureSubWrapper.style['max-height'] = heightValue + this.pictureSubWrapper.style['height'] = heightValue } let { width, height } = this.getDimensions() this.picture.style.width = width + 'px' @@ -486,6 +477,8 @@ export default { .picture-subwrapper { position: relative; + display: flex; + align-items: center; } .picture-player { diff --git a/src/components/sides/Sidebar.vue b/src/components/sides/Sidebar.vue index aed2733271..194da74a3d 100644 --- a/src/components/sides/Sidebar.vue +++ b/src/components/sides/Sidebar.vue @@ -1,6 +1,6 @@