@tsparticles/shape-rounded-rect 3.0.0-beta.1 → 3.0.0-beta.3
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 +1 -1
- package/browser/RoundedRectDrawer.js +2 -2
- package/cjs/RoundedRectDrawer.js +2 -2
- package/esm/RoundedRectDrawer.js +2 -2
- package/package.json +4 -4
- package/report.html +23 -5
- package/tsparticles.shape.rounded-rect.js +8 -3
- package/tsparticles.shape.rounded-rect.min.js +1 -1
- package/tsparticles.shape.rounded-rect.min.js.LICENSE.txt +1 -1
- package/types/RoundedRectDrawer.d.ts +3 -3
- package/umd/RoundedRectDrawer.js +2 -2
|
@@ -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.
|
|
7
|
+
* v3.0.0-beta.3
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -124,8 +124,13 @@ const fixFactor = Math.sqrt(2),
|
|
|
124
124
|
ctx.quadraticCurveTo(x, y, x + radius.topLeft, y);
|
|
125
125
|
};
|
|
126
126
|
class RoundedRectDrawer {
|
|
127
|
-
draw(
|
|
128
|
-
const
|
|
127
|
+
draw(data) {
|
|
128
|
+
const {
|
|
129
|
+
context,
|
|
130
|
+
particle,
|
|
131
|
+
radius
|
|
132
|
+
} = data,
|
|
133
|
+
fixedRadius = radius / fixFactor,
|
|
129
134
|
fixedDiameter = fixedRadius * 2,
|
|
130
135
|
borderRadius = particle.borderRadius ?? 5;
|
|
131
136
|
if ("roundRect" in context) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.shape.rounded-rect.min.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var o="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var r in o)("object"==typeof exports?exports:t)[r]=o[r]}}(this,(t=>(()=>{"use strict";var e={533:e=>{e.exports=t}},o={};function r(t){var i=o[t];if(void 0!==i)return i.exports;var n=o[t]={exports:{}};return e[t](n,n.exports,r),n.exports}r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{r.r(i),r.d(i,{loadRoundedRectShape:()=>n});var t=r(533);const e=Math.sqrt(2);class o{draw(t
|
|
2
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var o="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var r in o)("object"==typeof exports?exports:t)[r]=o[r]}}(this,(t=>(()=>{"use strict";var e={533:e=>{e.exports=t}},o={};function r(t){var i=o[t];if(void 0!==i)return i.exports;var n=o[t]={exports:{}};return e[t](n,n.exports,r),n.exports}r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{r.r(i),r.d(i,{loadRoundedRectShape:()=>n});var t=r(533);const e=Math.sqrt(2);class o{draw(t){const{context:o,particle:r,radius:i}=t,n=i/e,a=2*n,p=r.borderRadius??5;"roundRect"in o?o.roundRect(-n,-n,a,a,p):((t,e,o={topRight:4,bottomRight:4,bottomLeft:4,topLeft:4})=>{const{x:r,y:i,width:n,height:a}=e,p=r+n,d=i+a;t.moveTo(r+o.topLeft,i),t.lineTo(p-o.topRight,i),t.quadraticCurveTo(p,i,p,i+o.topRight),t.lineTo(p,i+a-o.bottomRight),t.quadraticCurveTo(p,d,p-o.bottomRight,d),t.lineTo(r+o.bottomLeft,d),t.quadraticCurveTo(r,d,r,d-o.bottomLeft),t.lineTo(r,i+o.topLeft),t.quadraticCurveTo(r,i,r+o.topLeft,i)})(o,{x:-n,y:-n,height:a,width:a},{topLeft:p,topRight:p,bottomLeft:p,bottomRight:p})}particleInit(e,o){const r=o.shapeData;o.borderRadius=(0,t.getRangeValue)(r?.radius??5)*e.retina.pixelRatio}}async function n(t,e=!0){await t.addShape("rounded-rect",new o,e)}})(),i})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Rounded Rect Shape v3.0.0-beta.
|
|
1
|
+
/*! tsParticles Rounded Rect Shape v3.0.0-beta.3 by Matteo Bruni */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Container, IShapeDrawer } from "@tsparticles/engine";
|
|
1
|
+
import type { Container, IShapeDrawData, IShapeDrawer } from "@tsparticles/engine";
|
|
2
2
|
import type { RoundedParticle } from "./RoundedParticle.js";
|
|
3
|
-
export declare class RoundedRectDrawer implements IShapeDrawer {
|
|
4
|
-
draw(
|
|
3
|
+
export declare class RoundedRectDrawer implements IShapeDrawer<RoundedParticle> {
|
|
4
|
+
draw(data: IShapeDrawData<RoundedParticle>): void;
|
|
5
5
|
particleInit(container: Container, particle: RoundedParticle): void;
|
|
6
6
|
}
|
package/umd/RoundedRectDrawer.js
CHANGED
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
ctx.quadraticCurveTo(x, y, x + radius.topLeft, y);
|
|
30
30
|
};
|
|
31
31
|
class RoundedRectDrawer {
|
|
32
|
-
draw(
|
|
33
|
-
const fixedRadius = radius / fixFactor, fixedDiameter = fixedRadius * 2, borderRadius = particle.borderRadius ?? 5;
|
|
32
|
+
draw(data) {
|
|
33
|
+
const { context, particle, radius } = data, fixedRadius = radius / fixFactor, fixedDiameter = fixedRadius * 2, borderRadius = particle.borderRadius ?? 5;
|
|
34
34
|
if ("roundRect" in context) {
|
|
35
35
|
context.roundRect(-fixedRadius, -fixedRadius, fixedDiameter, fixedDiameter, borderRadius);
|
|
36
36
|
}
|