@pixi/graphics-extras
Advanced tools
Comparing version 7.1.0-alpha to 7.1.0
/*! | ||
* @pixi/graphics-extras - v7.1.0-alpha | ||
* Compiled Thu, 10 Nov 2022 16:24:03 UTC | ||
* @pixi/graphics-extras - v7.1.0 | ||
* Compiled Tue, 10 Jan 2023 21:29:23 UTC | ||
* | ||
@@ -11,11 +11,2 @@ * @pixi/graphics-extras is licensed under the MIT License. | ||
function drawTorus(x, y, innerRadius, outerRadius, startArc = 0, endArc = Math.PI * 2) { | ||
if (Math.abs(endArc - startArc) >= Math.PI * 2) { | ||
return this.drawCircle(x, y, outerRadius).beginHole().drawCircle(x, y, innerRadius).endHole(); | ||
} | ||
this.finishPoly(); | ||
this.arc(x, y, innerRadius, endArc, startArc, true).arc(x, y, outerRadius, startArc, endArc, false).finishPoly(); | ||
return this; | ||
} | ||
function drawChamferRect(x, y, width, height, chamfer) { | ||
@@ -128,2 +119,11 @@ if (chamfer <= 0) { | ||
function drawTorus(x, y, innerRadius, outerRadius, startArc = 0, endArc = Math.PI * 2) { | ||
if (Math.abs(endArc - startArc) >= Math.PI * 2) { | ||
return this.drawCircle(x, y, outerRadius).beginHole().drawCircle(x, y, innerRadius).endHole(); | ||
} | ||
this.finishPoly(); | ||
this.arc(x, y, innerRadius, endArc, startArc, true).arc(x, y, outerRadius, startArc, endArc, false).finishPoly(); | ||
return this; | ||
} | ||
Object.defineProperties(graphics.Graphics.prototype, { | ||
@@ -130,0 +130,0 @@ drawTorus: { value: drawTorus }, |
/*! | ||
* @pixi/graphics-extras - v7.1.0-alpha | ||
* Compiled Thu, 10 Nov 2022 16:24:03 UTC | ||
* @pixi/graphics-extras - v7.1.0 | ||
* Compiled Tue, 10 Jan 2023 21:29:23 UTC | ||
* | ||
* @pixi/graphics-extras is licensed under the MIT License. | ||
* http://www.opensource.org/licenses/mit-license | ||
*/(function(y,d){"use strict";function T(t,a,h,r,o=0,n=Math.PI*2){return Math.abs(n-o)>=Math.PI*2?this.drawCircle(t,a,r).beginHole().drawCircle(t,a,h).endHole():(this.finishPoly(),this.arc(t,a,h,n,o,!0).arc(t,a,r,o,n,!1).finishPoly(),this)}function m(t,a,h,r,o){if(o<=0)return this.drawRect(t,a,h,r);const n=Math.min(o,Math.min(h,r)/2),l=t+h,c=a+r,s=[t+n,a,l-n,a,l,a+n,l,c-n,l-n,c,t+n,c,t,c-n,t,a+n];for(let e=s.length-1;e>=2;e-=2)s[e]===s[e-2]&&s[e-1]===s[e-3]&&s.splice(e-1,2);return this.drawPolygon(s)}function R(t,a,h,r,o){if(o===0)return this.drawRect(t,a,h,r);const n=Math.min(h,r)/2,l=Math.min(n,Math.max(-n,o)),c=t+h,s=a+r,e=l<0?-l:0,i=Math.abs(l);return this.moveTo(t,a+i).arcTo(t+e,a+e,t+i,a,i).lineTo(c-i,a).arcTo(c-e,a+e,c,a+i,i).lineTo(c,s-i).arcTo(c-e,s-e,t+h-i,s,i).lineTo(t+i,s).arcTo(t+e,s-e,t,s-i,i).closePath()}function p(t,a,h,r,o=0){r=Math.max(r|0,3);const n=-1*Math.PI/2+o,l=Math.PI*2/r,c=[];for(let s=0;s<r;s++){const e=s*l+n;c.push(t+h*Math.cos(e),a+h*Math.sin(e))}return this.drawPolygon(c)}function v(t,a,h,r,o,n=0){if(r=Math.max(r|0,3),o<=0)return this.drawRegularPolygon(t,a,h,r,n);const l=h*Math.sin(Math.PI/r)-.001;o=Math.min(o,l);const c=-1*Math.PI/2+n,s=Math.PI*2/r,e=(r-2)*Math.PI/r/2;for(let i=0;i<r;i++){const u=i*s+c,M=t+h*Math.cos(u),P=a+h*Math.sin(u),w=u+Math.PI+e,f=u-Math.PI-e,I=M+o*Math.cos(w),g=P+o*Math.sin(w),x=M+o*Math.cos(f),F=P+o*Math.sin(f);i===0?this.moveTo(I,g):this.lineTo(I,g),this.quadraticCurveTo(M,P,x,F)}return this.closePath()}class b extends d.Polygon{constructor(a,h,r,o,n,l=0){n=n||o/2;const c=-1*Math.PI/2+l,s=r*2,e=d.PI_2/s,i=[];for(let u=0;u<s;u++){const M=u%2?n:o,P=u*e+c;i.push(a+M*Math.cos(P),h+M*Math.sin(P))}super(i)}}function C(t,a,h,r,o,n=0){return this.drawPolygon(new b(t,a,h,r,o,n))}Object.defineProperties(y.Graphics.prototype,{drawTorus:{value:T},drawChamferRect:{value:m},drawFilletRect:{value:R},drawRegularPolygon:{value:p},drawRoundedPolygon:{value:v},drawStar:{value:C}})})(PIXI,PIXI); | ||
*/(function(y,d){"use strict";function T(t,a,h,r,o){if(o<=0)return this.drawRect(t,a,h,r);const n=Math.min(o,Math.min(h,r)/2),l=t+h,c=a+r,s=[t+n,a,l-n,a,l,a+n,l,c-n,l-n,c,t+n,c,t,c-n,t,a+n];for(let e=s.length-1;e>=2;e-=2)s[e]===s[e-2]&&s[e-1]===s[e-3]&&s.splice(e-1,2);return this.drawPolygon(s)}function m(t,a,h,r,o){if(o===0)return this.drawRect(t,a,h,r);const n=Math.min(h,r)/2,l=Math.min(n,Math.max(-n,o)),c=t+h,s=a+r,e=l<0?-l:0,i=Math.abs(l);return this.moveTo(t,a+i).arcTo(t+e,a+e,t+i,a,i).lineTo(c-i,a).arcTo(c-e,a+e,c,a+i,i).lineTo(c,s-i).arcTo(c-e,s-e,t+h-i,s,i).lineTo(t+i,s).arcTo(t+e,s-e,t,s-i,i).closePath()}function R(t,a,h,r,o=0){r=Math.max(r|0,3);const n=-1*Math.PI/2+o,l=Math.PI*2/r,c=[];for(let s=0;s<r;s++){const e=s*l+n;c.push(t+h*Math.cos(e),a+h*Math.sin(e))}return this.drawPolygon(c)}function p(t,a,h,r,o,n=0){if(r=Math.max(r|0,3),o<=0)return this.drawRegularPolygon(t,a,h,r,n);const l=h*Math.sin(Math.PI/r)-.001;o=Math.min(o,l);const c=-1*Math.PI/2+n,s=Math.PI*2/r,e=(r-2)*Math.PI/r/2;for(let i=0;i<r;i++){const u=i*s+c,M=t+h*Math.cos(u),P=a+h*Math.sin(u),w=u+Math.PI+e,f=u-Math.PI-e,I=M+o*Math.cos(w),g=P+o*Math.sin(w),x=M+o*Math.cos(f),F=P+o*Math.sin(f);i===0?this.moveTo(I,g):this.lineTo(I,g),this.quadraticCurveTo(M,P,x,F)}return this.closePath()}class v extends d.Polygon{constructor(a,h,r,o,n,l=0){n=n||o/2;const c=-1*Math.PI/2+l,s=r*2,e=d.PI_2/s,i=[];for(let u=0;u<s;u++){const M=u%2?n:o,P=u*e+c;i.push(a+M*Math.cos(P),h+M*Math.sin(P))}super(i)}}function b(t,a,h,r,o,n=0){return this.drawPolygon(new v(t,a,h,r,o,n))}function C(t,a,h,r,o=0,n=Math.PI*2){return Math.abs(n-o)>=Math.PI*2?this.drawCircle(t,a,r).beginHole().drawCircle(t,a,h).endHole():(this.finishPoly(),this.arc(t,a,h,n,o,!0).arc(t,a,r,o,n,!1).finishPoly(),this)}Object.defineProperties(y.Graphics.prototype,{drawTorus:{value:C},drawChamferRect:{value:T},drawFilletRect:{value:m},drawRegularPolygon:{value:R},drawRoundedPolygon:{value:p},drawStar:{value:b}})})(PIXI,PIXI); | ||
//# sourceMappingURL=graphics-extras.min.js.map |
/// <reference path="../global.d.ts" /> | ||
import { drawTorus } from './drawTorus'; | ||
import { drawChamferRect } from './drawChamferRect'; | ||
@@ -8,2 +7,3 @@ import { drawFilletRect } from './drawFilletRect'; | ||
import { drawStar } from './drawStar'; | ||
import { drawTorus } from './drawTorus'; | ||
export interface IGraphicsExtras { | ||
@@ -10,0 +10,0 @@ drawTorus: typeof drawTorus; |
'use strict'; | ||
var graphics = require('@pixi/graphics'); | ||
var drawTorus = require('./drawTorus.js'); | ||
var drawChamferRect = require('./drawChamferRect.js'); | ||
@@ -10,2 +9,3 @@ var drawFilletRect = require('./drawFilletRect.js'); | ||
var drawStar = require('./drawStar.js'); | ||
var drawTorus = require('./drawTorus.js'); | ||
@@ -12,0 +12,0 @@ Object.defineProperties(graphics.Graphics.prototype, { |
{ | ||
"name": "@pixi/graphics-extras", | ||
"version": "7.1.0-alpha", | ||
"version": "7.1.0", | ||
"main": "lib/index.js", | ||
@@ -24,7 +24,7 @@ "module": "lib/index.mjs", | ||
"homepage": "http://pixijs.com/", | ||
"bugs": "https://github.com/pixijs/pixi.js/issues", | ||
"bugs": "https://github.com/pixijs/pixijs/issues", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/pixijs/pixi.js.git" | ||
"url": "https://github.com/pixijs/pixijs.git" | ||
}, | ||
@@ -43,3 +43,3 @@ "publishConfig": { | ||
], | ||
"gitHead": "0fb26a500c738cb550da277c112d15d9dd3f87b6" | ||
"gitHead": "4079e92895ecb692afe9f0b15d3e48ee40852ada" | ||
} |
@@ -26,1 +26,17 @@ # @pixi/graphics-extras | ||
``` | ||
## CDN Install | ||
Via jsDelivr: | ||
```html | ||
<!-- This script tag should be placed after pixi.min.js --> | ||
<script src="https://cdn.jsdelivr.net/npm/@pixi/graphics-extras@7.x/dist/graphics-extras.min.js"></script> | ||
``` | ||
Or via unpkg: | ||
```html | ||
<!-- This script tag should be placed after pixi.min.js --> | ||
<script src="https://unpkg.com/@pixi/graphics-extras@7.x/dist/graphics-extras.min.js"></script> | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
96420
0
42