@melonjs/debug-plugin 14.5.1 → 14.6.0

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.
package/README.md CHANGED
@@ -46,5 +46,5 @@ Questions, need help ?
46
46
  -------------------------------------------------------------------------------
47
47
  If you need technical support, you can contact us through the following channels :
48
48
  * Forums: with melonJS 2 we moved to a new discourse [forum](https://melonjs.discourse.group), but we can still also find the previous one [here](http://www.html5gamedevs.com/forum/32-melonjs/)
49
- * Chat: come and chat with us on [discord](https://discord.gg/aur7JMk), or [gitter](https://gitter.im/melonjs/public)
49
+ * Chat: come and chat with us on [discord](https://discord.gg/aur7JMk)
50
50
  * we tried to keep our [wikipage](https://github.com/melonjs/melonJS/wiki) up-to-date with useful links, tutorials, and anything related melonJS.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS debug plugin - v14.5.1
2
+ * melonJS debug plugin - v14.6.0
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.1";
74
+ this.version = "14.6.0";
75
75
 
76
76
  // persistent
77
77
  this.isPersistent = true;
@@ -202,8 +202,7 @@ class DebugPanel extends Renderable {
202
202
 
203
203
  if (typeof this.ancestor !== "undefined") {
204
204
  renderer.save();
205
- // if this object of this renderable parent is not the root container
206
- if (!this.root && !this.ancestor.root && this.ancestor.isFloating) {
205
+ if (!this.floating) {
207
206
  var absolutePosition = this.ancestor.getAbsolutePosition();
208
207
  renderer.translate(
209
208
  -absolutePosition.x,
@@ -212,8 +211,10 @@ class DebugPanel extends Renderable {
212
211
  }
213
212
  }
214
213
 
214
+ var bounds = this.getBounds();
215
+
215
216
  renderer.setColor("green");
216
- renderer.stroke(this.getBounds());
217
+ renderer.stroke(bounds);
217
218
 
218
219
  // the sprite mask if defined
219
220
  if (typeof this.mask !== "undefined") {
@@ -222,7 +223,6 @@ class DebugPanel extends Renderable {
222
223
  }
223
224
 
224
225
  if (typeof this.body !== "undefined") {
225
- var bounds = this.getBounds();
226
226
  renderer.translate(bounds.x, bounds.y);
227
227
 
228
228
  renderer.setColor("orange");
@@ -314,7 +314,7 @@ class DebugPanel extends Renderable {
314
314
 
315
315
  if (typeof this.ancestor !== "undefined") {
316
316
  // if this object of this renderable parent is not the root container
317
- if (!this.root && !this.ancestor.root && this.ancestor.isFloating) {
317
+ if (!this.floating) {
318
318
  var absolutePosition = this.ancestor.getAbsolutePosition();
319
319
  renderer.translate(
320
320
  -absolutePosition.x,
@@ -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.1",
3
+ "version": "14.6.0",
4
4
  "description": "melonJS debug plugin",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "main": "dist/@melonjs/debug-plugin.js",
40
40
  "module": "dist/@melonjs/debug-plugin.js",
41
+ "types": "dist/index.d.ts",
41
42
  "sideEffects": false,
42
43
  "files": [
43
44
  "dist/@melonjs/debug-plugin.js",
@@ -47,26 +48,28 @@
47
48
  "LICENSE"
48
49
  ],
49
50
  "peerDependencies": {
50
- "melonjs": "^15.0.0"
51
+ "melonjs": "^15.1.6"
51
52
  },
52
53
  "devDependencies": {
53
- "@babel/eslint-parser": "^7.21.3",
54
+ "@babel/eslint-parser": "^7.21.8",
54
55
  "@babel/plugin-syntax-import-assertions": "^7.20.0",
55
56
  "@rollup/plugin-commonjs": "^24.1.0",
56
57
  "@rollup/plugin-image": "^3.0.2",
57
58
  "@rollup/plugin-node-resolve": "^15.0.2",
58
59
  "@rollup/plugin-replace": "^5.0.2",
59
60
  "del-cli": "^5.0.0",
60
- "eslint": "^8.38.0",
61
- "eslint-plugin-jsdoc": "^43.0.0",
62
- "rollup": "^3.20.5",
61
+ "eslint": "^8.40.0",
62
+ "eslint-plugin-jsdoc": "^44.2.2",
63
+ "rollup": "^3.21.6",
63
64
  "rollup-plugin-bundle-size": "^1.0.3",
64
- "rollup-plugin-string": "^3.0.0"
65
+ "rollup-plugin-string": "^3.0.0",
66
+ "typescript": "^5.0.4"
65
67
  },
66
68
  "scripts": {
67
- "build": "npm run lint && rollup -c --silent",
69
+ "build": "npm run lint && rollup -c --silent && npm run types",
68
70
  "lint": "eslint src/**.js rollup.config.mjs",
69
71
  "prepublishOnly": "npm run build",
70
- "clean": "del-cli --force build/*.*"
72
+ "clean": "del-cli --force dist/*.*",
73
+ "types": "tsc"
71
74
  }
72
75
  }
package/src/debugPanel.js CHANGED
@@ -198,8 +198,7 @@ class DebugPanel extends Renderable {
198
198
 
199
199
  if (typeof this.ancestor !== "undefined") {
200
200
  renderer.save();
201
- // if this object of this renderable parent is not the root container
202
- if (!this.root && !this.ancestor.root && this.ancestor.isFloating) {
201
+ if (!this.floating) {
203
202
  var absolutePosition = this.ancestor.getAbsolutePosition();
204
203
  renderer.translate(
205
204
  -absolutePosition.x,
@@ -208,8 +207,10 @@ class DebugPanel extends Renderable {
208
207
  }
209
208
  }
210
209
 
210
+ var bounds = this.getBounds();
211
+
211
212
  renderer.setColor("green");
212
- renderer.stroke(this.getBounds());
213
+ renderer.stroke(bounds);
213
214
 
214
215
  // the sprite mask if defined
215
216
  if (typeof this.mask !== "undefined") {
@@ -218,7 +219,6 @@ class DebugPanel extends Renderable {
218
219
  }
219
220
 
220
221
  if (typeof this.body !== "undefined") {
221
- var bounds = this.getBounds();
222
222
  renderer.translate(bounds.x, bounds.y);
223
223
 
224
224
  renderer.setColor("orange");
@@ -310,7 +310,7 @@ class DebugPanel extends Renderable {
310
310
 
311
311
  if (typeof this.ancestor !== "undefined") {
312
312
  // if this object of this renderable parent is not the root container
313
- if (!this.root && !this.ancestor.root && this.ancestor.isFloating) {
313
+ if (!this.floating) {
314
314
  var absolutePosition = this.ancestor.getAbsolutePosition();
315
315
  renderer.translate(
316
316
  -absolutePosition.x,
@@ -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
@@ -1,5 +1,5 @@
1
1
  import { utils, plugin } from "melonjs";
2
- import DebugPanel from "./debugPanel.js";
2
+ import DebugPanel from "./debugPanel";
3
3
 
4
4
  /**
5
5
  * @classdesc
@@ -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