Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to execute 'drawImage' on 'CanvasRenderingContext2D' #23

Open
JaPod993 opened this issue Mar 5, 2020 · 1 comment
Open

Failed to execute 'drawImage' on 'CanvasRenderingContext2D' #23

JaPod993 opened this issue Mar 5, 2020 · 1 comment

Comments

@JaPod993
Copy link

JaPod993 commented Mar 5, 2020

Hi, I'm having trouble implementing your game in my vue project.

im tring to use this ad component like that:

 <puzzle-board
            :src="img" :cols="3" :rows="3" :autoResize="true" :showNumber="true"  :width="300" :height="300" />

But whatever i do there is always this error:
DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.

When I inspect the network it seems taht my image is loading fine so i don't know what's the problem. Can yiu give me any clues?

@meganetaaan
Copy link
Owner

Thank you for using vue-8-puzzle and giving feedback.

DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.

In my component this error occurs when

  1. The puzzle-board component is set autoResize to "true".
  2. The container of puzzle-board has 0 width/height calculated.
<template>
    <div class="container">
      <puzzle-board v-if="show"
        :autoResize="true"
        :src="src"
      />
    </div>
</template>
<style>
  .container {
    width: 0px; /* this causes error */
  }
</style>

Could you check if the container's size has zero value?
If it still does not work, I'd like to have more detail (The code to reproduce and full client log).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants