@pixi/canvas-graphics
Advanced tools
Comparing version 5.0.0-rc.2 to 5.0.0-rc.3
/*! | ||
* @pixi/canvas-graphics - v5.0.0-rc.2 | ||
* Compiled Mon, 18 Feb 2019 23:45:28 UTC | ||
* @pixi/canvas-graphics - v5.0.0-rc.3 | ||
* Compiled Fri, 22 Mar 2019 16:33:44 UTC | ||
* | ||
@@ -84,9 +84,63 @@ * @pixi/canvas-graphics is licensed under the MIT License. | ||
this.renderPolygon(shape.points, shape.closed, context); | ||
var points = shape.points; | ||
var holes = data.holes; | ||
var outerArea = (void 0); | ||
var innerArea = (void 0); | ||
for (var j = 0; j < data.holes.length; j++) | ||
context.moveTo(points[0], points[1]); | ||
for (var j = 2; j < points.length; j += 2) | ||
{ | ||
// this.renderPolygon(data.holes[j].points, true, context); | ||
context.lineTo(points[j], points[j + 1]); | ||
} | ||
if (shape.closeStroke) | ||
{ | ||
context.closePath(); | ||
} | ||
if (holes.length > 0) | ||
{ | ||
outerArea = 0; | ||
for (var j$1 = 0; j$1 < points.length; j$1 += 2) | ||
{ | ||
outerArea += (points[j$1] * points[j$1 + 3]) - (points[j$1 + 1] * points[j$1 + 2]); | ||
} | ||
for (var k = 0; k < holes.length; k++) | ||
{ | ||
points = holes[k].points; | ||
innerArea = 0; | ||
for (var j$2 = 0; j$2 < points.length; j$2 += 2) | ||
{ | ||
innerArea += (points[j$2] * points[j$2 + 3]) - (points[j$2 + 1] * points[j$2 + 2]); | ||
} | ||
if (innerArea * outerArea < 0) | ||
{ | ||
context.moveTo(points[0], points[1]); | ||
for (var j$3 = 2; j$3 < points.length; j$3 += 2) | ||
{ | ||
context.lineTo(points[j$3], points[j$3 + 1]); | ||
} | ||
} | ||
else | ||
{ | ||
context.moveTo(points[points.length - 2], points[points.length - 1]); | ||
for (var j$4 = points.length - 4; j$4 >= 0; j$4 -= 2) | ||
{ | ||
context.lineTo(points[j$4], points[j$4 + 1]); | ||
} | ||
} | ||
if (holes[k].shape.closeStroke) | ||
{ | ||
context.closePath(); | ||
} | ||
} | ||
} | ||
if (fillStyle.visible) | ||
@@ -262,24 +316,2 @@ { | ||
/** | ||
* Renders a polygon. | ||
* | ||
* @param {PIXI.Point[]} points - The points to render | ||
* @param {boolean} close - Should the polygon be closed | ||
* @param {CanvasRenderingContext2D} context - The rendering context to use | ||
*/ | ||
CanvasGraphicsRenderer.prototype.renderPolygon = function renderPolygon (points, close, context) | ||
{ | ||
context.moveTo(points[0], points[1]); | ||
for (var j = 1; j < points.length / 2; ++j) | ||
{ | ||
context.lineTo(points[j * 2], points[(j * 2) + 1]); | ||
} | ||
if (close) | ||
{ | ||
context.closePath(); | ||
} | ||
}; | ||
/** | ||
* destroy graphics object | ||
@@ -297,3 +329,4 @@ * | ||
/** | ||
* Generates a canvas texture. | ||
* Generates a canvas texture. Only available with **pixi.js-legacy** bundle | ||
* or the **@pixi/canvas-graphics** package. | ||
* @method generateCanvasTexture | ||
@@ -300,0 +333,0 @@ * @memberof PIXI.Graphics# |
/*! | ||
* @pixi/canvas-graphics - v5.0.0-rc.2 | ||
* Compiled Mon, 18 Feb 2019 23:45:28 UTC | ||
* @pixi/canvas-graphics - v5.0.0-rc.3 | ||
* Compiled Fri, 22 Mar 2019 16:33:44 UTC | ||
* | ||
@@ -14,3 +14,3 @@ * @pixi/canvas-graphics is licensed under the MIT License. | ||
var graphics = require('@pixi/graphics'); | ||
var canvasRenderer = require('@pixi/canvas-renderer'); | ||
var canvasRenderer$1 = require('@pixi/canvas-renderer'); | ||
var core = require('@pixi/core'); | ||
@@ -47,8 +47,8 @@ | ||
*/ | ||
CanvasGraphicsRenderer.prototype.render = function render (graphics$$1) | ||
CanvasGraphicsRenderer.prototype.render = function render (graphics) | ||
{ | ||
var renderer = this.renderer; | ||
var context = renderer.context; | ||
var worldAlpha = graphics$$1.worldAlpha; | ||
var transform = graphics$$1.transform.worldTransform; | ||
var worldAlpha = graphics.worldAlpha; | ||
var transform = graphics.transform.worldTransform; | ||
var resolution = renderer.resolution; | ||
@@ -66,9 +66,9 @@ | ||
// update tint if graphics was dirty | ||
if (graphics$$1.canvasTintDirty !== graphics$$1.dirty | ||
|| graphics$$1._prevTint !== graphics$$1.tint) | ||
if (graphics.canvasTintDirty !== graphics.dirty | ||
|| graphics._prevTint !== graphics.tint) | ||
; | ||
renderer.setBlendMode(graphics$$1.blendMode); | ||
renderer.setBlendMode(graphics.blendMode); | ||
var graphicsData = graphics$$1.geometry.graphicsData; | ||
var graphicsData = graphics.geometry.graphicsData; | ||
@@ -91,9 +91,63 @@ for (var i = 0; i < graphicsData.length; i++) | ||
this.renderPolygon(shape.points, shape.closed, context); | ||
var points = shape.points; | ||
var holes = data.holes; | ||
var outerArea = (void 0); | ||
var innerArea = (void 0); | ||
for (var j = 0; j < data.holes.length; j++) | ||
context.moveTo(points[0], points[1]); | ||
for (var j = 2; j < points.length; j += 2) | ||
{ | ||
// this.renderPolygon(data.holes[j].points, true, context); | ||
context.lineTo(points[j], points[j + 1]); | ||
} | ||
if (shape.closeStroke) | ||
{ | ||
context.closePath(); | ||
} | ||
if (holes.length > 0) | ||
{ | ||
outerArea = 0; | ||
for (var j$1 = 0; j$1 < points.length; j$1 += 2) | ||
{ | ||
outerArea += (points[j$1] * points[j$1 + 3]) - (points[j$1 + 1] * points[j$1 + 2]); | ||
} | ||
for (var k = 0; k < holes.length; k++) | ||
{ | ||
points = holes[k].points; | ||
innerArea = 0; | ||
for (var j$2 = 0; j$2 < points.length; j$2 += 2) | ||
{ | ||
innerArea += (points[j$2] * points[j$2 + 3]) - (points[j$2 + 1] * points[j$2 + 2]); | ||
} | ||
if (innerArea * outerArea < 0) | ||
{ | ||
context.moveTo(points[0], points[1]); | ||
for (var j$3 = 2; j$3 < points.length; j$3 += 2) | ||
{ | ||
context.lineTo(points[j$3], points[j$3 + 1]); | ||
} | ||
} | ||
else | ||
{ | ||
context.moveTo(points[points.length - 2], points[points.length - 1]); | ||
for (var j$4 = points.length - 4; j$4 >= 0; j$4 -= 2) | ||
{ | ||
context.lineTo(points[j$4], points[j$4 + 1]); | ||
} | ||
} | ||
if (holes[k].shape.closeStroke) | ||
{ | ||
context.closePath(); | ||
} | ||
} | ||
} | ||
if (fillStyle.visible) | ||
@@ -237,14 +291,14 @@ { | ||
*/ | ||
CanvasGraphicsRenderer.prototype.updateGraphicsTint = function updateGraphicsTint (graphics$$1) | ||
CanvasGraphicsRenderer.prototype.updateGraphicsTint = function updateGraphicsTint (graphics) | ||
{ | ||
graphics$$1._prevTint = graphics$$1.tint; | ||
graphics$$1.canvasTintDirty = graphics$$1.dirty; | ||
graphics._prevTint = graphics.tint; | ||
graphics.canvasTintDirty = graphics.dirty; | ||
var tintR = ((graphics$$1.tint >> 16) & 0xFF) / 255; | ||
var tintG = ((graphics$$1.tint >> 8) & 0xFF) / 255; | ||
var tintB = (graphics$$1.tint & 0xFF) / 255; | ||
var tintR = ((graphics.tint >> 16) & 0xFF) / 255; | ||
var tintG = ((graphics.tint >> 8) & 0xFF) / 255; | ||
var tintB = (graphics.tint & 0xFF) / 255; | ||
for (var i = 0; i < graphics$$1.graphicsData.length; ++i) | ||
for (var i = 0; i < graphics.graphicsData.length; ++i) | ||
{ | ||
var data = graphics$$1.graphicsData[i]; | ||
var data = graphics.graphicsData[i]; | ||
@@ -270,24 +324,2 @@ var fillColor = data.fillColor | 0; | ||
/** | ||
* Renders a polygon. | ||
* | ||
* @param {PIXI.Point[]} points - The points to render | ||
* @param {boolean} close - Should the polygon be closed | ||
* @param {CanvasRenderingContext2D} context - The rendering context to use | ||
*/ | ||
CanvasGraphicsRenderer.prototype.renderPolygon = function renderPolygon (points, close, context) | ||
{ | ||
context.moveTo(points[0], points[1]); | ||
for (var j = 1; j < points.length / 2; ++j) | ||
{ | ||
context.lineTo(points[j * 2], points[(j * 2) + 1]); | ||
} | ||
if (close) | ||
{ | ||
context.closePath(); | ||
} | ||
}; | ||
/** | ||
* destroy graphics object | ||
@@ -301,7 +333,8 @@ * | ||
var canvasRenderer$1; | ||
var canvasRenderer; | ||
var tempMatrix = new math.Matrix(); | ||
/** | ||
* Generates a canvas texture. | ||
* Generates a canvas texture. Only available with **pixi.js-legacy** bundle | ||
* or the **@pixi/canvas-graphics** package. | ||
* @method generateCanvasTexture | ||
@@ -321,5 +354,5 @@ * @memberof PIXI.Graphics# | ||
if (!canvasRenderer$1) | ||
if (!canvasRenderer) | ||
{ | ||
canvasRenderer$1 = new canvasRenderer.CanvasRenderer(); | ||
canvasRenderer = new canvasRenderer$1.CanvasRenderer(); | ||
} | ||
@@ -335,3 +368,3 @@ | ||
canvasRenderer$1.render(this, canvasBuffer, true, tempMatrix); | ||
canvasRenderer.render(this, canvasBuffer, true, tempMatrix); | ||
@@ -338,0 +371,0 @@ var texture = core.Texture.from(canvasBuffer.baseTexture._canvasRenderTarget.canvas, { |
{ | ||
"name": "@pixi/canvas-graphics", | ||
"version": "5.0.0-rc.2", | ||
"version": "5.0.0-rc.3", | ||
"main": "lib/canvas-graphics.js", | ||
"module": "lib/canvas-graphics.es.js", | ||
"bundle": "dist/canvas-graphics.js", | ||
"description": "Canvas mixin for the graphics package", | ||
@@ -22,14 +23,15 @@ "author": "Mat Groves", | ||
"files": [ | ||
"lib" | ||
"lib", | ||
"dist" | ||
], | ||
"dependencies": { | ||
"@pixi/canvas-renderer": "^5.0.0-rc.2", | ||
"@pixi/core": "^5.0.0-rc.2", | ||
"@pixi/graphics": "^5.0.0-rc.2", | ||
"@pixi/math": "^5.0.0-rc.2" | ||
"@pixi/canvas-renderer": "^5.0.0-rc.3", | ||
"@pixi/core": "^5.0.0-rc.3", | ||
"@pixi/graphics": "^5.0.0-rc.3", | ||
"@pixi/math": "^5.0.0-rc.3" | ||
}, | ||
"devDependencies": { | ||
"floss": "^2.1.5" | ||
"floss": "^2.2.0" | ||
}, | ||
"gitHead": "53b354f4e01d3baee7223756dd09a3163ad29d0f" | ||
"gitHead": "8bd27c8b903ae2c8f90d91d64e82d65b19ac1cdb" | ||
} |
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
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
142408
11
1018
Updated@pixi/core@^5.0.0-rc.3
Updated@pixi/graphics@^5.0.0-rc.3
Updated@pixi/math@^5.0.0-rc.3