Code Monkey home page Code Monkey logo

demos's Issues

Chatbox demo fails on scrolling with touchpad

Expected Behaviour

When scrolling inside the chatbox window, when I hit the bottom, nothing should scroll not even the background div.

Actual Behaviour

When scrolling inside the chatbox window, when I hit the bottom the background page is scrolling.

Resizing offscreen canvas

This is for your offscreen canvas example. When you try to upload a second image an error occurs because there is an attempt to resize a canvas that has already transferred control to offscreen.

screenshot 2018-04-17 at 11 17 21 am

I am also running into this issue with a website i'm developing. The only difference is that my website requires the canvas to be resized after certain events occur.

I would resize a normal canvas with code like this:

this.$.canvas.width = this.size * window.devicePixelRatio;
this.$.canvas.height = this.size * window.devicePixelRatio;
    
this.$.canvas.style.width = this.size + 'px';
this.$.canvas.style.height = this.size + 'px';
this._ctx.scale(window.devicePixelRatio, window.devicePixelRatio);

Ever since I started using offscreen canvas that code would throw the same error as above. I tired instead setting the width and height of the offscreen canvas object. I also set the scale in a web worker because i'm running the animation off the main thread. There is no error when I do this however it does not seem to resize properly.

Main

this._offscreen.width = this.size * window.devicePixelRatio;
this._offscreen.height = this.size * window.devicePixelRatio;
    
this.$.canvas.style.width = this.size + 'px';
this.$.canvas.style.height = this.size + 'px';

Web Worker

self.onmessage = e => {
  if (e.data.devicePixelRatio) {
    ctx.scale(e.data.devicePixelRatio, e.data.devicePixelRatio);
    ctx.commit();
  }
}

I was wondering if anyone knows how to resize an offscreen canvas properly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.