@tsparticles/shape-arrow 3.0.0-beta.2 → 3.0.0-beta.4

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-beta.2
7
+ * v3.0.0-beta.4
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -99,8 +99,13 @@ var engine_root_window_ = __webpack_require__(533);
99
99
  ;// CONCATENATED MODULE: ./dist/browser/ArrowDrawer.js
100
100
 
101
101
  class ArrowDrawer {
102
- draw(context, particle, radius) {
103
- const width = radius * 2,
102
+ draw(data) {
103
+ const {
104
+ context,
105
+ particle,
106
+ radius
107
+ } = data,
108
+ width = radius * 2,
104
109
  heightFactor = particle.heightFactor ?? 0.5,
105
110
  headWidthFactor = particle.headWidthFactor ?? 0.2,
106
111
  bodyHeightFactor = particle.bodyHeightFactor ?? 0.5,
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.shape.arrow.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function r(e){var a=o[e];if(void 0!==a)return a.exports;var i=o[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{r.r(a),r.d(a,{loadArrowShape:()=>o});var e=r(533);class t{draw(e,t,o){const r=2*o,a=r*(t.heightFactor??.5),i=r*(t.headWidthFactor??.2),n=a*(t.bodyHeightFactor??.5);e.moveTo(-r/2,0),e.lineTo(-r/2,-n/2),e.lineTo(r/2-i,-n/2),e.lineTo(r/2-i,-a/2),e.lineTo(r/2+i,0),e.lineTo(r/2-i,a/2),e.lineTo(r/2-i,n/2),e.lineTo(-r/2,n/2),e.lineTo(-r/2,0)}particleInit(t,o){const r=o.shapeData;o.heightFactor=(0,e.getRangeValue)(r?.heightFactor??.5),o.headWidthFactor=(0,e.getRangeValue)(r?.headWidthFactor??.2),o.bodyHeightFactor=(0,e.getRangeValue)(r?.bodyHeightFactor??.5)}}async function o(e,o=!0){await e.addShape("arrow",new t,o)}})(),a})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function r(e){var a=o[e];if(void 0!==a)return a.exports;var i=o[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{r.r(a),r.d(a,{loadArrowShape:()=>o});var e=r(533);class t{draw(e){const{context:t,particle:o,radius:r}=e,a=2*r,i=a*(o.heightFactor??.5),n=a*(o.headWidthFactor??.2),c=i*(o.bodyHeightFactor??.5);t.moveTo(-a/2,0),t.lineTo(-a/2,-c/2),t.lineTo(a/2-n,-c/2),t.lineTo(a/2-n,-i/2),t.lineTo(a/2+n,0),t.lineTo(a/2-n,i/2),t.lineTo(a/2-n,c/2),t.lineTo(-a/2,c/2),t.lineTo(-a/2,0)}particleInit(t,o){const r=o.shapeData;o.heightFactor=(0,e.getRangeValue)(r?.heightFactor??.5),o.headWidthFactor=(0,e.getRangeValue)(r?.headWidthFactor??.2),o.bodyHeightFactor=(0,e.getRangeValue)(r?.bodyHeightFactor??.5)}}async function o(e,o=!0){await e.addShape("arrow",new t,o)}})(),a})()));
@@ -1 +1 @@
1
- /*! tsParticles Arrow Shape v3.0.0-beta.2 by Matteo Bruni */
1
+ /*! tsParticles Arrow Shape v3.0.0-beta.4 by Matteo Bruni */
@@ -1,6 +1,6 @@
1
- import { type Container, type IShapeDrawer } from "@tsparticles/engine";
1
+ import { type Container, type IShapeDrawData, type IShapeDrawer } from "@tsparticles/engine";
2
2
  import type { ArrowParticle } from "./ArrowParticle.js";
3
- export declare class ArrowDrawer implements IShapeDrawer {
4
- draw(context: CanvasRenderingContext2D, particle: ArrowParticle, radius: number): void;
3
+ export declare class ArrowDrawer implements IShapeDrawer<ArrowParticle> {
4
+ draw(data: IShapeDrawData<ArrowParticle>): void;
5
5
  particleInit(container: Container, particle: ArrowParticle): void;
6
6
  }
@@ -12,8 +12,8 @@
12
12
  exports.ArrowDrawer = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
14
  class ArrowDrawer {
15
- draw(context, particle, radius) {
16
- const width = radius * 2, heightFactor = particle.heightFactor ?? 0.5, headWidthFactor = particle.headWidthFactor ?? 0.2, bodyHeightFactor = particle.bodyHeightFactor ?? 0.5, height = width * heightFactor, headWidth = width * headWidthFactor, bodyHeight = height * bodyHeightFactor;
15
+ draw(data) {
16
+ const { context, particle, radius } = data, width = radius * 2, heightFactor = particle.heightFactor ?? 0.5, headWidthFactor = particle.headWidthFactor ?? 0.2, bodyHeightFactor = particle.bodyHeightFactor ?? 0.5, height = width * heightFactor, headWidth = width * headWidthFactor, bodyHeight = height * bodyHeightFactor;
17
17
  context.moveTo(-width / 2, 0);
18
18
  context.lineTo(-width / 2, -bodyHeight / 2);
19
19
  context.lineTo(width / 2 - headWidth, -bodyHeight / 2);