@britannica/pablito
Advanced tools
Comparing version
@@ -102,2 +102,7 @@ // utility forEach method, because nodeLists don't implement forEach | ||
// Set sticker mode | ||
document.getElementById('set-sticker-mode').addEventListener('click', function() { | ||
stickerbook.enterStickerMode(); | ||
}); | ||
// Wire up clear | ||
@@ -104,0 +109,0 @@ document.getElementById('clear').addEventListener('click', function() { |
{ | ||
"name": "@britannica/pablito", | ||
"description": "An HTML 5 drawing framework", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"main": "./dist/stickerbook.bundle.js", | ||
@@ -6,0 +6,0 @@ "module": "./dist/stickerbook.bundle.js", |
@@ -7,3 +7,3 @@ const MaskedPath = require('../masked-path'); | ||
*/ | ||
const PencilEraserBrush = fabric.util.createClass(fabric.PencilBrush, { | ||
const PencilEraserBrush = window.fabric.util.createClass(window.fabric.PencilBrush, { | ||
/** | ||
@@ -10,0 +10,0 @@ * Overriding the base onMouseDown to fix a weird bug I was seeing: The first path didn't render |
@@ -14,4 +14,12 @@ const mouseDownHandler = function (evt) { | ||
} | ||
const clickPoint = this._canvas.getPointer(evt.e); | ||
const stickerImgWidth = this.state.sticker.width; | ||
const stickerImgHeight = this.state.sticker.height; | ||
return this.placeSticker(this._canvas.getPointer(evt.e)); | ||
// Adjust coordinates of sticker placement on canvas so that the sticker is centered on the click coordinates | ||
clickPoint.x -= stickerImgWidth / 2; | ||
clickPoint.y -= stickerImgHeight / 2; | ||
return this.placeSticker(clickPoint); | ||
}; | ||
@@ -18,0 +26,0 @@ |
@@ -370,2 +370,12 @@ import validate from './validation/validate'; | ||
enterStickerMode() { | ||
this._setState({ | ||
img: null, | ||
_stickerAdded: false, | ||
drawing: false, | ||
}); | ||
this._canvas.setCursor('move'); | ||
} | ||
setPan() { | ||
@@ -372,0 +382,0 @@ throw new Error('not yet implemented: Stickerbook.setPan()'); |
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 too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1635877
61.19%30165
638.07%2
-33.33%4
33.33%