@tsparticles/shape-line 3.0.0-alpha.1 → 3.0.0-beta.1

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.
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.0.0-alpha.1
7
+ * v3.0.0-beta.1
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -57,14 +57,16 @@ __webpack_require__.r(__webpack_exports__);
57
57
 
58
58
  // EXPORTS
59
59
  __webpack_require__.d(__webpack_exports__, {
60
- "loadLineShape": () => (/* binding */ loadLineShape)
60
+ loadLineShape: () => (/* binding */ loadLineShape)
61
61
  });
62
62
 
63
63
  ;// CONCATENATED MODULE: ./dist/browser/LineDrawer.js
64
64
  class LineDrawer {
65
65
  draw(context, particle, radius) {
66
+ const shapeData = particle.shapeData;
66
67
  context.moveTo(-radius / 2, 0);
67
68
  context.lineTo(radius / 2, 0);
69
+ context.lineCap = shapeData?.cap ?? "butt";
68
70
  }
69
71
  getSidesCount() {
70
72
  return 1;
@@ -72,8 +74,8 @@ class LineDrawer {
72
74
  }
73
75
  ;// CONCATENATED MODULE: ./dist/browser/index.js
74
76
 
75
- async function loadLineShape(engine) {
76
- await engine.addShape("line", new LineDrawer());
77
+ async function loadLineShape(engine, refresh = true) {
78
+ await engine.addShape("line", new LineDrawer(), refresh);
77
79
  }
78
80
  /******/ return __webpack_exports__;
79
81
  /******/ })()
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.shape.line.min.js.LICENSE.txt */
2
- !function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define([],o);else{var t=o();for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(this,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var r in t)e.o(t,r)&&!e.o(o,r)&&Object.defineProperty(o,r,{enumerable:!0,get:t[r]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{loadLineShape:()=>r});class t{draw(e,o,t){e.moveTo(-t/2,0),e.lineTo(t/2,0)}getSidesCount(){return 1}}async function r(e){await e.addShape("line",new t)}return o})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(()=>(()=>{"use strict";var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{loadLineShape:()=>n});class o{draw(e,t,o){const n=t.shapeData;e.moveTo(-o/2,0),e.lineTo(o/2,0),e.lineCap=n?.cap??"butt"}getSidesCount(){return 1}}async function n(e,t=!0){await e.addShape("line",new o,t)}return t})()));
@@ -1,8 +1 @@
1
- /*!
2
- * Author : Matteo Bruni
3
- * MIT license: https://opensource.org/licenses/MIT
4
- * Demo / Generator : https://particles.js.org/
5
- * GitHub : https://www.github.com/matteobruni/tsparticles
6
- * How to use? : Check the GitHub README
7
- * v3.0.0-alpha.1
8
- */
1
+ /*! tsParticles Line Shape v3.0.0-beta.1 by Matteo Bruni */
package/types/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import type { Engine } from "@tsparticles/engine";
2
- export declare function loadLineShape(engine: Engine): Promise<void>;
2
+ export declare function loadLineShape(engine: Engine, refresh?: boolean): Promise<void>;
package/umd/LineDrawer.js CHANGED
@@ -12,8 +12,10 @@
12
12
  exports.LineDrawer = void 0;
13
13
  class LineDrawer {
14
14
  draw(context, particle, radius) {
15
+ const shapeData = particle.shapeData;
15
16
  context.moveTo(-radius / 2, 0);
16
17
  context.lineTo(radius / 2, 0);
18
+ context.lineCap = shapeData?.cap ?? "butt";
17
19
  }
18
20
  getSidesCount() {
19
21
  return 1;
package/umd/index.js CHANGED
@@ -4,15 +4,15 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./LineDrawer"], factory);
7
+ define(["require", "exports", "./LineDrawer.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.loadLineShape = void 0;
13
- const LineDrawer_1 = require("./LineDrawer");
14
- async function loadLineShape(engine) {
15
- await engine.addShape("line", new LineDrawer_1.LineDrawer());
13
+ const LineDrawer_js_1 = require("./LineDrawer.js");
14
+ async function loadLineShape(engine, refresh = true) {
15
+ await engine.addShape("line", new LineDrawer_js_1.LineDrawer(), refresh);
16
16
  }
17
17
  exports.loadLineShape = loadLineShape;
18
18
  });