Skip to main content

useSurface

useSurface(): ShallowRef<Surface>

Composable that provides access to a Surface in the current scope, as a reactive ref.

<script setup>
import { useSurface } from "@visuallyjs/browser-ui-vue"

const surface = useSurface()

function zoomToFit() {
surface?.zoomToFit()
}

</script>

<template>
<button :click="zoomToFit()">Zoom to fit</button>
</template>

Returns

ShallowRef<Surface>