wgge 0.1.30 → 0.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -109,7 +109,12 @@ export default class CanvasRenderer extends RendererBase {
109
109
  }
110
110
 
111
111
  drawImage(image, drawStart, drawEnd, imageStart, imageEnd, opacity = 1, clear = true) {
112
- if (!(image && this.checkContext())) return;
112
+ if (!image) {
113
+ console.error('No image to draw!');
114
+ return;
115
+ }
116
+ if (!this.checkContext()) return;
117
+
113
118
  if (clear) this.context2d.clearRect(drawStart.x, drawStart.y, drawEnd.x, drawEnd.y);
114
119
  this.context2d.globalAlpha = opacity;
115
120
  console.log(
@@ -34,7 +34,7 @@ export default class ImageCanvasRenderer extends CanvasRenderer {
34
34
 
35
35
  renderImage() {
36
36
  if (!(this.image && this.context2d)) return;
37
- const half = this.viewSize.multiply(0.5 / this.model.actualZoom.get());
37
+ const half = this.model.viewSize.multiply(0.5 / this.model.actualZoom.get());
38
38
  const start = this.model.actualCoordinates.subtract(half);
39
39
  const end = this.model.actualCoordinates.add(half);
40
40
  this.drawImage(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wgge",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "description": "Web GL Game Engine",
5
5
  "main": "index.js",
6
6
  "dependencies": {