setunset
The "Set Unset" tool acts similar to the ctx.save() method, by applying changes to the context, and then unsetting after usage.
This allows the switching of a property of the context with set and unset
values previously assigned to changed properties are reapplied - essentially wrapping
some drawing with context changes.
su = new SetUnset({
lineWidth: 10
})
// lineWidth == ...
su.set(ctx)
// lineWidth == 10
su.unset(ctx)
// lineWidth == ...
Implement shortcuts:
class Stroke extends SetUnset {
getOpts() {
let supported = new Set([
, "lineWidth"
])
let map = {
color: 'strokeStyle'
}
let functional = {
dash: 'lineDashKeyApply'
}
return [supported, map, functional]
}
}
st = new Stroke({
color: 'red'
})
Meta Data
| filepath_exists | True |
| path | setunset |
| filepath | setunset.js |
| clean_files | () |