question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VueSignaturePad not display properly until browser resize

See original GitHub issue

Hi, I am clearly doing something wrong but when I view the page with the signature pad on it all I get is the border until I manually resize the browser window, then the signature pad appear along with anything that may have been scribbled onto the blank space. Below is the code:

<template>
    <v-container fluid grid-list-md>
        <div class="display-1">Create a new order</div>
        <v-dialog v-model="dialog" fullscreen hide-overlay transition="dialog-bottom-transition">
          <v-btn slot="activator" color="primary" dark>Sign For Order</v-btn>
          <v-card height="100%">
            <v-toolbar dark color="primary">
              <v-toolbar-title>Sign Below</v-toolbar-title>
              <v-btn icon dark @click="dialog = !dialog"></v-btn>
            </v-toolbar>

            <VueSignaturePad
              width="95%"
              height="80%"
              ref="signaturePad"
              :options="sigopt"
              :customStyle="sigStyle"
            />

            <v-btn @click="clear">Clear</v-btn>
            <v-btn @click="save">Finalize Order</v-btn>
          </v-card>
        </v-dialog>
    </v-container>
</template>

<script>
import VueSignaturePad from 'vue-signature-pad'

export default {
  created() {
  },
  data() {
    return {
      sigopt: {
        backgroundColor: 'rgb(250,235,215)',
        minWidth: 2.0,
      },
      sigStyle: { 
        border: '1px black solid',
      },
      dialog: false,
    }
  },
  methods: {
    clear() {
    },
    save() {
      this.dialog = false
    },
  },
  components: {
    VueSignaturePad
  }
}
</script>

Sorry if this isn’t the place to ask this but,=, is it my code or a bug of some kind. Kindly appreciate any help. Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

35reactions
camoorecommented, May 28, 2019

I ran into this same issue and the best solution I found was to call the resizeCanvas in the onBegin function

<VueSignaturePad :options="{onBegin: () => {$refs.signaturePad.resizeCanvas()}}" ref="signaturePad"/>

9reactions
Leemanbokcommented, Jan 30, 2019

I got the same experience and found one of the solutions.

 this.$nextTick(function () {
            this.$refs.signaturePad.resizeCanvas()
          })

After the event that the screen changes, I called the resize command of the pad and found that the width and height were normally applied.

Write in the hope that it will help you a little. : D

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why doesn't vue-signature-pad work in a modal?
Its due to dialog not having width & height yet when the canvas is initializing within it, to solve it, you can pass...
Read more >
Vue Signature Pad Component
There are a few workarounds though, e.g. you can lock screen orientation, or read an image from the canvas before resizing it and...
Read more >
[Solved]-Why doesn't vue-signature-pad work in a modal?
Open DevTools and look at the canvas element. At first you will see its width and height (not width and height styles) is...
Read more >
Vue Signature Pad Component - Morioh
This scaling is also necessary to properly display signatures loaded via ... an image from the canvas before resizing it and write the...
Read more >
vue-signature-pad - npm
SignaturePad component for Vue.js. Latest version: 3.0.2, last published: 10 months ago. Start using vue-signature-pad in your project by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found