1
0
Fork 0

feat: Do not set plugin configuration object on pattern.use()

Plugins can pass a configuration object (or any
sort of data) when loaded with `pattern.use()`.

We use to set that parameter to `false` when loading, but
now we leave it `undefined`. This makes is easy for plugins
to use a default parameter for the configuration/data passed
to it.
This commit is contained in:
Joost De Cock 2020-04-18 11:36:02 +02:00
parent e134e940e7
commit ff82e2568b

View file

@ -321,7 +321,7 @@ Pattern.prototype.on = function(hook, method, data) {
this.hooks[hook].push({ method, data }) this.hooks[hook].push({ method, data })
} }
Pattern.prototype.use = function(plugin, data = false) { Pattern.prototype.use = function (plugin, data) {
this.debug({ this.debug({
type: 'success', type: 'success',
label: '🔌 Plugin loaded', label: '🔌 Plugin loaded',
@ -416,8 +416,9 @@ Pattern.prototype.pack = function() {
this.parts[partId].attributes.add('transform', transform) this.parts[partId].attributes.add('transform', transform)
} }
if (transforms.rotate) { if (transforms.rotate) {
let transform = `rotate(${transforms.rotate}, ${center.x - anchor.x}, ${center.y - let transform = `rotate(${transforms.rotate}, ${center.x - anchor.x}, ${
anchor.y})` center.y - anchor.y
})`
this.parts[partId].attributes.add('transform', transform) this.parts[partId].attributes.add('transform', transform)
} }
} }