Skip to content

Commit

Permalink
feat(Screen): allow to zoom and pan screenshare content
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Dec 23, 2024
1 parent 2e25edc commit 107c559
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions src/components/CallView/shared/Screen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<script>
import Hex from 'crypto-js/enc-hex.js'
import SHA1 from 'crypto-js/sha1.js'
import panzoom from 'panzoom'
import { ref, onMounted, onBeforeUnmount } from 'vue'

import { t } from '@nextcloud/l10n'

Expand Down Expand Up @@ -64,7 +66,27 @@ export default {

setup() {
const guestNameStore = useGuestNameStore()
return { guestNameStore }

const screen = ref(null)
const screenPanzoomInstance = ref(null)

onMounted(() => {
screenPanzoomInstance.value = panzoom(screen.value, {
minZoom: 1,
maxZoom: 8,
bounds: true,
boundsPadding: 1,
})
})
onBeforeUnmount(() => {
screenPanzoomInstance.value?.dispose()
})

return {
guestNameStore,
screen,
screenPanzoomInstance,
}
},

computed: {
Expand Down Expand Up @@ -111,11 +133,10 @@ export default {
return remoteParticipantName
},
screenClass() {
if (this.isBig) {
return 'screen--fit'
} else {
return 'screen--fill'
}
return [
this.isBig ? 'screen--fit' : 'screen--fill',
this.screenPanzoomInstance ? 'screen--magnify' : '',
]
},

},
Expand Down Expand Up @@ -182,6 +203,9 @@ export default {
&--fill {
object-fit: cover;
}
&--magnify {
cursor: zoom-in;
}
}

</style>

0 comments on commit 107c559

Please sign in to comment.