-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: view transition in Presenter mode (#1363)
Co-authored-by: _Kerman <kermanx@qq.com>
- Loading branch information
Showing
8 changed files
with
76 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<script setup lang="ts"> | ||
import { computed, defineAsyncComponent, ref, toRef } from 'vue' | ||
import type { PropType } from 'vue' | ||
import { provideLocal } from '@vueuse/core' | ||
import type { ClicksContext, RenderContext, SlideRoute } from '@slidev/types' | ||
import { injectionActive, injectionClicksContext, injectionCurrentPage, injectionRenderContext, injectionRoute } from '../constants' | ||
import SlideLoading from './SlideLoading.vue' | ||
const props = defineProps({ | ||
clicksContext: { | ||
type: Object as PropType<ClicksContext>, | ||
required: true, | ||
}, | ||
renderContext: { | ||
type: String as PropType<RenderContext>, | ||
default: 'slide', | ||
}, | ||
active: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
is: { | ||
required: true, | ||
}, | ||
route: { | ||
type: Object as PropType<SlideRoute>, | ||
required: true, | ||
}, | ||
}) | ||
provideLocal(injectionRoute, props.route) | ||
provideLocal(injectionCurrentPage, ref(props.route.no)) | ||
provideLocal(injectionRenderContext, ref(props.renderContext as RenderContext)) | ||
provideLocal(injectionActive, toRef(props, 'active')) | ||
provideLocal(injectionClicksContext, toRef(props, 'clicksContext')) | ||
const style = computed(() => { | ||
const zoom = props.route.meta?.slide?.frontmatter.zoom ?? 1 | ||
return zoom === 1 | ||
? undefined | ||
: { | ||
width: `${100 / zoom}%`, | ||
height: `${100 / zoom}%`, | ||
transformOrigin: 'top left', | ||
transform: `scale(${zoom})`, | ||
} | ||
}) | ||
const SlideComponent = defineAsyncComponent({ | ||
loader: (props.is as any), | ||
delay: 300, | ||
loadingComponent: SlideLoading, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<component :is="SlideComponent" :style="style" :class="{ 'disable-view-transition': !['slide', 'presenter'].includes(props.renderContext) }" /> | ||
</template> | ||
|
||
<style scoped> | ||
.disable-view-transition:deep(*) { | ||
view-transition-name: none !important; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters