wgge 0.1.26 → 0.1.28
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.
|
@@ -2,6 +2,14 @@ import DirtyValue from "./DirtyValue";
|
|
|
2
2
|
|
|
3
3
|
export default class IntValue extends DirtyValue {
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @return Number
|
|
8
|
+
*/
|
|
9
|
+
get() {
|
|
10
|
+
return super.get();
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
set(value) {
|
|
6
14
|
if (value === null || value === undefined || value === '') {
|
|
7
15
|
super.set(Number.NaN);
|
|
@@ -17,4 +25,8 @@ export default class IntValue extends DirtyValue {
|
|
|
17
25
|
increase(num) {
|
|
18
26
|
this.set(this.get() + num);
|
|
19
27
|
}
|
|
28
|
+
|
|
29
|
+
multiply(num) {
|
|
30
|
+
this.set(this.get() * num);
|
|
31
|
+
}
|
|
20
32
|
}
|
|
@@ -97,6 +97,17 @@ export default class CanvasRenderer extends RendererBase {
|
|
|
97
97
|
if (!(image && this.context2d)) return;
|
|
98
98
|
if (clear) this.context2d.clearRect(drawStart.x, drawStart.y, drawEnd.x, drawEnd.y);
|
|
99
99
|
this.context2d.globalAlpha = opacity;
|
|
100
|
+
console.log(
|
|
101
|
+
'drawing to canvas',
|
|
102
|
+
imageStart.x,
|
|
103
|
+
imageStart.y,
|
|
104
|
+
imageEnd.x,
|
|
105
|
+
imageEnd.y,
|
|
106
|
+
drawStart.x,
|
|
107
|
+
drawStart.y,
|
|
108
|
+
drawEnd.x,
|
|
109
|
+
drawEnd.y
|
|
110
|
+
);
|
|
100
111
|
this.context2d.drawImage(
|
|
101
112
|
image,
|
|
102
113
|
imageStart.x,
|
|
@@ -52,6 +52,7 @@ export default class ImageCanvasRenderer extends CanvasRenderer {
|
|
|
52
52
|
if (this.model.image.uri.isEmpty()) return;
|
|
53
53
|
this.game.assets.getAsset(this.model.image.uri.get(), (img) => {
|
|
54
54
|
this.image = img;
|
|
55
|
+
this.model.image.size.set(img.width, img.height);
|
|
55
56
|
this.renderImage();
|
|
56
57
|
});
|
|
57
58
|
}
|
|
@@ -17,7 +17,7 @@ export default class ImageViewRenderer extends DomRenderer {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
activateInternal() {
|
|
20
|
-
this.canvas = DOMHelper.createElement(this.dom, 'canvas');
|
|
20
|
+
this.canvas = DOMHelper.createElement(this.dom, 'canvas', 'image-view-canvas');
|
|
21
21
|
this.addChild(new ImageCanvasRenderer(this.game, this.model, this.canvas));
|
|
22
22
|
|
|
23
23
|
this.updateSize();
|