javascript - Canvas Working Fine In All Browsers Except Chrome -
I get a hvs js script which takes an image and pulls it into the canvas code works perfectly in all the browsers except chrome I have included the relevant
this.tile = document.createElement ('canvas'); Var ctx = this.tile.getContext ("2D"); This.tile.width = ((size.cm_size) * (((this.image.width) / this.app.dpi.active) * 2.54)). Tofix (2); This.tile.height = ((size.cm_size) * (((this.image.height) / this.app.dpi.active) * 2.54)). Tofix (2); If this (this.scale> gt; 0) {// breaks it into 2 lines chrome, this.tile.width = this.tile.width * this.scale; This.tile.height = this.tile.height * this.scale; } Ctx.drawImage (this.image, 0, 0, this.image.width, this.image.height, 0, 0, this.image.width, this.image.height); I have commented on those 2 lines that break things in chrome, by removing these lines things work out.
With these lines in place, as long as I do not increase the 'this.app.dpi.active' variable to 350 (it starts at 150). As soon as this happens, it shows how it is in Firefox.
There are no error messages, the tile is just empty.
Here is a list of values for 'this.app. Tile is not displayed until price dpi hit 350 until dpi.active 'and resulting tile width and height.
150 DPI = 9444 x 9444 200 DPI = 7084 x 7084 250 DPI = 5668 x 5668 300 DPI = 4720 x 4720 350 DPI = 4048 x 4048 I have seen these Values in Chrome and Firefox and they are similar but work in Firefox. This scale value = 4 and when width and height this Does not multiply by scale, it works fine in FF and Chrome.
Please tell me if you need more code or any questions.
I do not think you can use the element constructor I always document.createElement ('Canvas') In my FF console, there is an error in using the Element Constructor.
Comments
Post a Comment