@melonjs/debug-plugin 14.5.0 → 14.5.2

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS debug plugin - v14.5.0
2
+ * melonJS debug plugin - v14.5.2
3
3
  * http://www.melonjs.org
4
4
  * @melonjs/debug-plugin is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -71,7 +71,7 @@ class DebugPanel extends Renderable {
71
71
  this.name = "debugPanel";
72
72
 
73
73
  // the debug panel version
74
- this.version = "14.5.0";
74
+ this.version = "14.5.2";
75
75
 
76
76
  // persistent
77
77
  this.isPersistent = true;
@@ -201,12 +201,9 @@ class DebugPanel extends Renderable {
201
201
  if (_this.checkbox.renderHitBox.selected && this.getBounds().isFinite()) {
202
202
 
203
203
  if (typeof this.ancestor !== "undefined") {
204
- var absolutePosition = this.ancestor.getAbsolutePosition();
205
-
206
204
  renderer.save();
207
-
208
- // if this object of this renderable parent is not the root container
209
- if (!this.root && !this.ancestor.root && this.ancestor.floating) {
205
+ if (!this.floating) {
206
+ var absolutePosition = this.ancestor.getAbsolutePosition();
210
207
  renderer.translate(
211
208
  -absolutePosition.x,
212
209
  -absolutePosition.y
@@ -214,8 +211,10 @@ class DebugPanel extends Renderable {
214
211
  }
215
212
  }
216
213
 
214
+ var bounds = this.getBounds();
215
+
217
216
  renderer.setColor("green");
218
- renderer.stroke(this.getBounds());
217
+ renderer.stroke(bounds);
219
218
 
220
219
  // the sprite mask if defined
221
220
  if (typeof this.mask !== "undefined") {
@@ -224,7 +223,6 @@ class DebugPanel extends Renderable {
224
223
  }
225
224
 
226
225
  if (typeof this.body !== "undefined") {
227
- var bounds = this.getBounds();
228
226
  renderer.translate(bounds.x, bounds.y);
229
227
 
230
228
  renderer.setColor("orange");
@@ -282,12 +280,11 @@ class DebugPanel extends Renderable {
282
280
  var bounds = this.getBounds();
283
281
 
284
282
  if (typeof this.ancestor !== "undefined") {
285
- var absolutePosition = this.ancestor.getAbsolutePosition();
286
-
287
283
  renderer.save();
288
284
 
289
285
  // if this object of this renderable parent is not the root container
290
- if (!this.root && !this.ancestor.root && this.ancestor.floating) {
286
+ if (!this.root && !this.ancestor.root && this.ancestor.isFloating) {
287
+ var absolutePosition = this.ancestor.getAbsolutePosition();
291
288
  renderer.translate(
292
289
  -absolutePosition.x,
293
290
  -absolutePosition.y
@@ -297,6 +294,10 @@ class DebugPanel extends Renderable {
297
294
 
298
295
  renderer.setColor("green");
299
296
  renderer.stroke(bounds);
297
+
298
+ if (typeof this.ancestor !== "undefined") {
299
+ renderer.restore();
300
+ }
300
301
  }
301
302
  });
302
303
 
@@ -312,10 +313,9 @@ class DebugPanel extends Renderable {
312
313
 
313
314
 
314
315
  if (typeof this.ancestor !== "undefined") {
315
- var absolutePosition = this.ancestor.getAbsolutePosition();
316
-
317
316
  // if this object of this renderable parent is not the root container
318
- if (!this.root && !this.ancestor.root && this.ancestor.floating) {
317
+ if (!this.floating) {
318
+ var absolutePosition = this.ancestor.getAbsolutePosition();
319
319
  renderer.translate(
320
320
  -absolutePosition.x,
321
321
  -absolutePosition.y
@@ -324,8 +324,14 @@ class DebugPanel extends Renderable {
324
324
  }
325
325
 
326
326
  if (this.renderable instanceof Renderable) {
327
+ var rbounds = this.renderable.getBounds();
328
+ var rx = -rbounds.x - this.anchorPoint.x * rbounds.width,
329
+ ry = -rbounds.y - this.anchorPoint.y * rbounds.height;
330
+
327
331
  renderer.setColor("green");
328
- renderer.stroke(this.renderable.getBounds());
332
+ renderer.translate(rx, ry);
333
+ renderer.stroke(rbounds);
334
+ renderer.translate(-rx, -ry);
329
335
  }
330
336
 
331
337
  renderer.translate(
@@ -591,7 +597,7 @@ class DebugPanelPlugin extends plugin.Base {
591
597
  super();
592
598
 
593
599
  // minimum melonJS version expected
594
- this.version = "14.5.0";
600
+ this.version = "15.1.5";
595
601
 
596
602
  this.panel = new DebugPanel(debugToggle);
597
603
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melonjs/debug-plugin",
3
- "version": "14.5.0",
3
+ "version": "14.5.2",
4
4
  "description": "melonJS debug plugin",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -47,19 +47,19 @@
47
47
  "LICENSE"
48
48
  ],
49
49
  "peerDependencies": {
50
- "melonjs": "^15.0.0"
50
+ "melonjs": "^15.1.5"
51
51
  },
52
52
  "devDependencies": {
53
- "@babel/eslint-parser": "^7.21.3",
53
+ "@babel/eslint-parser": "^7.21.8",
54
54
  "@babel/plugin-syntax-import-assertions": "^7.20.0",
55
55
  "@rollup/plugin-commonjs": "^24.1.0",
56
56
  "@rollup/plugin-image": "^3.0.2",
57
57
  "@rollup/plugin-node-resolve": "^15.0.2",
58
58
  "@rollup/plugin-replace": "^5.0.2",
59
59
  "del-cli": "^5.0.0",
60
- "eslint": "^8.38.0",
61
- "eslint-plugin-jsdoc": "^43.0.0",
62
- "rollup": "^3.20.5",
60
+ "eslint": "^8.39.0",
61
+ "eslint-plugin-jsdoc": "^43.1.1",
62
+ "rollup": "^3.21.5",
63
63
  "rollup-plugin-bundle-size": "^1.0.3",
64
64
  "rollup-plugin-string": "^3.0.0"
65
65
  },
package/src/debugPanel.js CHANGED
@@ -197,12 +197,9 @@ class DebugPanel extends Renderable {
197
197
  if (_this.checkbox.renderHitBox.selected && this.getBounds().isFinite()) {
198
198
 
199
199
  if (typeof this.ancestor !== "undefined") {
200
- var absolutePosition = this.ancestor.getAbsolutePosition();
201
-
202
200
  renderer.save();
203
-
204
- // if this object of this renderable parent is not the root container
205
- if (!this.root && !this.ancestor.root && this.ancestor.floating) {
201
+ if (!this.floating) {
202
+ var absolutePosition = this.ancestor.getAbsolutePosition();
206
203
  renderer.translate(
207
204
  -absolutePosition.x,
208
205
  -absolutePosition.y
@@ -210,8 +207,10 @@ class DebugPanel extends Renderable {
210
207
  }
211
208
  }
212
209
 
210
+ var bounds = this.getBounds();
211
+
213
212
  renderer.setColor("green");
214
- renderer.stroke(this.getBounds());
213
+ renderer.stroke(bounds);
215
214
 
216
215
  // the sprite mask if defined
217
216
  if (typeof this.mask !== "undefined") {
@@ -220,7 +219,6 @@ class DebugPanel extends Renderable {
220
219
  }
221
220
 
222
221
  if (typeof this.body !== "undefined") {
223
- var bounds = this.getBounds();
224
222
  renderer.translate(bounds.x, bounds.y);
225
223
 
226
224
  renderer.setColor("orange");
@@ -278,12 +276,11 @@ class DebugPanel extends Renderable {
278
276
  var bounds = this.getBounds();
279
277
 
280
278
  if (typeof this.ancestor !== "undefined") {
281
- var absolutePosition = this.ancestor.getAbsolutePosition();
282
-
283
279
  renderer.save();
284
280
 
285
281
  // if this object of this renderable parent is not the root container
286
- if (!this.root && !this.ancestor.root && this.ancestor.floating) {
282
+ if (!this.root && !this.ancestor.root && this.ancestor.isFloating) {
283
+ var absolutePosition = this.ancestor.getAbsolutePosition();
287
284
  renderer.translate(
288
285
  -absolutePosition.x,
289
286
  -absolutePosition.y
@@ -293,6 +290,10 @@ class DebugPanel extends Renderable {
293
290
 
294
291
  renderer.setColor("green");
295
292
  renderer.stroke(bounds);
293
+
294
+ if (typeof this.ancestor !== "undefined") {
295
+ renderer.restore();
296
+ }
296
297
  }
297
298
  });
298
299
 
@@ -308,10 +309,9 @@ class DebugPanel extends Renderable {
308
309
 
309
310
 
310
311
  if (typeof this.ancestor !== "undefined") {
311
- var absolutePosition = this.ancestor.getAbsolutePosition();
312
-
313
312
  // if this object of this renderable parent is not the root container
314
- if (!this.root && !this.ancestor.root && this.ancestor.floating) {
313
+ if (!this.floating) {
314
+ var absolutePosition = this.ancestor.getAbsolutePosition();
315
315
  renderer.translate(
316
316
  -absolutePosition.x,
317
317
  -absolutePosition.y
@@ -320,8 +320,14 @@ class DebugPanel extends Renderable {
320
320
  }
321
321
 
322
322
  if (this.renderable instanceof Renderable) {
323
+ var rbounds = this.renderable.getBounds();
324
+ var rx = -rbounds.x - this.anchorPoint.x * rbounds.width,
325
+ ry = -rbounds.y - this.anchorPoint.y * rbounds.height;
326
+
323
327
  renderer.setColor("green");
324
- renderer.stroke(this.renderable.getBounds());
328
+ renderer.translate(rx, ry);
329
+ renderer.stroke(rbounds);
330
+ renderer.translate(-rx, -ry);
325
331
  }
326
332
 
327
333
  renderer.translate(
package/src/index.js CHANGED
@@ -33,7 +33,7 @@ export class DebugPanelPlugin extends plugin.Base {
33
33
  super();
34
34
 
35
35
  // minimum melonJS version expected
36
- this.version = "14.5.0";
36
+ this.version = "15.1.5";
37
37
 
38
38
  this.panel = new DebugPanel(debugToggle);
39
39