@xpadev-net/niconicomments 0.1.5 → 0.1.6

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.
Files changed (2) hide show
  1. package/dist/bundle.js +19 -1
  2. package/package.json +2 -4
package/dist/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- niconicomments.js v0.1.5
2
+ niconicomments.js v0.1.6
3
3
  (c) 2021 xpadev-net https://xpadevn.et
4
4
  Released under the MIT License.
5
5
  */
@@ -151,6 +151,7 @@
151
151
  this.getFont();
152
152
  this.getCommentSize();
153
153
  this.getCommentPos();
154
+ this.sortComment();
154
155
  }
155
156
  /**
156
157
  * コマンドをもとに各コメントに適用するフォントを決定する
@@ -404,6 +405,23 @@
404
405
  }
405
406
  }
406
407
  }
408
+
409
+ sortComment() {
410
+ for (let vpos in this.timeline) {
411
+ this.timeline[vpos].sort((a, b) => {
412
+ const A = this.data[a];
413
+ const B = this.data[b];
414
+
415
+ if (!A.owner && B.owner) {
416
+ return -1;
417
+ } else if (A.owner && !B.owner) {
418
+ return 1;
419
+ } else {
420
+ return 0;
421
+ }
422
+ });
423
+ }
424
+ }
407
425
  /**
408
426
  * context.measureTextの複数行対応版
409
427
  * 画面外にはみ出すコメントの縮小も行う
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpadev-net/niconicomments",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "NiconiComments is a comment drawing library that is somewhat compatible with the official Nico Nico Douga player.",
5
5
  "main": "dist/bundle.js",
6
6
  "scripts": {
@@ -25,9 +25,7 @@
25
25
  "homepage": "https://xpadev.net/niconicomments/docs/",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "rollup": "^2.61.1"
29
- },
30
- "dependencies": {
28
+ "rollup": "^2.61.1",
31
29
  "@rollup/plugin-babel": "^5.3.0"
32
30
  }
33
31
  }