4.0.9 • Published 29 days ago

vue-marmoset-viewer v4.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
29 days ago

A responsive and configurable Marmoset Viewer component for Vue.

Features

  • Dynamic: Dynamically loads the Marmoset Viewer source code as soon as its required.
  • 📱 Responsive: Fully responsive. Supports touch controls.
  • 🔁 Reactive: Reacts to property changes.
  • ⚒️ Manual access: If required, directly access the Marmoset script with provided type declarations.

Links

Installation

v1.x.x supports Vue 2, while v2.0.0 and onward target Vue 3.

# yarn
$ yarn add vue-marmoset-viewer

# npm
$ npm install vue-marmoset-viewer

Usage

Vue 3

import { createApp } from 'vue'
import { MarmosetViewer } from 'vue-marmoset-viewer'

const app = createApp()

app.use(MarmosetViewer)

Vue 2

import Vue from 'vue'
import MarmosetViewer from 'vue-marmoset-viewer'

Vue.use(MarmosetViewer)
<template>
  <marmoset-viewer
    src="/file.mview"
    :width="800"
    :height="600"
    :auto-start="true"
  />
</template>

or

<template>
  <marmoset-viewer src="/file.mview" responsive />
</template>

If responsive is set to true, the component will fill the available space of its parent.

Note: All properties of the component are reactive.

Events

  • load: Emitted when the underlying viewer is done loading.
  • unload: Emitted when an underlying viewer has been unloaded, because the component is destroyed or recreated.
  • resize: Emitted when the underlying viewer has been resized manually or automatically, when the responsive property is set to true.

Nuxt

Nuxt 2 is not supported by v2.0.0 and onward.

  1. Create the file plugins/marmosetViewer.ts with the following content.
import Vue from 'vue'
import MarmosetViewer from 'vue-marmoset-viewer'

Vue.use(MarmosetViewer)
  1. Update the plugins array in nuxt.config.js.
export default {
  plugins: [{ src: '~/plugins/marmosetViewer.ts' }],
}

Manual usage

In addition to the component, this library also allows for direct access of the Marmoset script. After the Promise returned by loadMarmoset() is resolved, the script can be accessed at document.marmoset. While the required types are included in this library, keep in mind that this can only be done client-side, as it requires document to be available.

Options

The following options are available (taken from https://marmoset.co/posts/viewer-integration-guide/):

TypeNameDefaultDescription
numberwidth800Width of viewer frame in points. This setting is ignored in full frame mode.
numberheight600Height of viewer frame in points. This setting is ignored in full frame mode.
booleanautoStartfalseStarts the viewer loading process immediately upon load (user does not have to press the play button). Leaving this disabled can save bandwidth and page load time.

In addition, the following options can be set when embedding a Marmoset viewer manually.

TypeNameDefaultDescription
booleanfullFramefalseWhen enabled, stretches the viewer rectangle to fill the available frame (the containing window or iframe). This setting is ignored when the “pagePreset” option is enabled.
booleanpagePresetfalseWhen enabled, constructs a full standalone web page around the viewer, with a resizable frame. Useful for creating a simple, decent-looking presentation without having to construct a page yourself.
stringthumbnailURLundefinedIf supplied, this image URL will be used for the load screen instead of the thumbnail extracted from the mview file. For best results, ensure that the given URL will not cause a cross-origin conflict.

Development

# install dependencies
$ pnpm install

# build for production
$ pnpm build

# lint project files
$ pnpm lint

Disclaimer

Please keep the license of the Marmoset Viewer, which will be loaded dynamically, in mind. The (current) license is as follows:

Copyright (c) Marmoset LLC.
All rights reserved.

Redistribution and use of this software are permitted provided
that the software remains whole and unmodified and this copyright
notice remains attached. Use or inclusion of any portion of this
code in other software programs is prohibited, excepting simple
embedding of this file in web applications. This software, or any
derivatives thereof, may not be resold, rented, leased, or
distributed on any other for-charge basis.

THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

License

MIT - Copyright © Jan Müller

4.0.9

29 days ago

4.0.8

2 months ago

4.0.7

3 months ago

4.0.6

3 months ago

4.0.5

4 months ago

4.0.4

4 months ago

4.0.3

5 months ago

3.2.2

9 months ago

3.2.1

9 months ago

3.2.0

9 months ago

4.0.1

8 months ago

4.0.0

8 months ago

4.0.2

8 months ago

3.1.2

1 year ago

3.0.81

1 year ago

3.0.82

1 year ago

3.0.80

1 year ago

3.0.83

1 year ago

3.0.84

1 year ago

3.0.67

2 years ago

3.0.68

2 years ago

3.0.66

2 years ago

3.0.69

2 years ago

3.0.78

1 year ago

3.0.79

1 year ago

3.1.1

1 year ago

3.0.76

1 year ago

3.1.0

1 year ago

3.0.77

1 year ago

3.0.70

2 years ago

3.0.71

2 years ago

3.0.74

1 year ago

3.0.75

1 year ago

3.0.72

1 year ago

3.0.73

1 year ago

3.0.56

2 years ago

3.0.57

2 years ago

3.0.54

2 years ago

3.0.55

2 years ago

3.0.58

2 years ago

3.0.59

2 years ago

3.0.52

2 years ago

3.0.53

2 years ago

3.0.51

2 years ago

3.0.65

2 years ago

3.0.60

2 years ago

3.0.63

2 years ago

3.0.64

2 years ago

3.0.61

2 years ago

3.0.62

2 years ago

3.0.45

2 years ago

3.0.46

2 years ago

3.0.43

2 years ago

3.0.44

2 years ago

3.0.49

2 years ago

3.0.47

2 years ago

3.0.48

2 years ago

3.0.41

2 years ago

3.0.42

2 years ago

3.0.40

2 years ago

3.0.50

2 years ago

3.0.27

2 years ago

3.0.28

2 years ago

3.0.25

2 years ago

3.0.26

2 years ago

3.0.34

2 years ago

3.0.35

2 years ago

3.0.32

2 years ago

3.0.33

2 years ago

3.0.38

2 years ago

3.0.39

2 years ago

3.0.36

2 years ago

3.0.37

2 years ago

3.0.30

2 years ago

3.0.31

2 years ago

3.0.29

2 years ago

3.0.23

2 years ago

3.0.24

2 years ago

3.0.21

2 years ago

3.0.22

2 years ago

3.0.20

2 years ago

3.0.18

2 years ago

3.0.19

2 years ago

3.0.12

2 years ago

3.0.13

2 years ago

3.0.11

2 years ago

3.0.16

2 years ago

3.0.17

2 years ago

3.0.14

2 years ago

3.0.15

2 years ago

3.0.9

2 years ago

3.0.10

2 years ago

2.0.15

2 years ago

2.0.16

2 years ago

2.0.13

2 years ago

2.0.14

2 years ago

2.0.11

2 years ago

2.0.12

2 years ago

2.1.0

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.0

2 years ago

2.0.18

2 years ago

2.0.9

2 years ago

2.0.10

2 years ago

2.0.8

2 years ago

2.0.7

2 years ago

2.0.6

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.3.2

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.0.0

3 years ago