Move change property logic to lib

This commit is contained in:
Lukas Martinelli
2016-12-30 16:56:20 +01:00
parent 7b631b0510
commit bda7ce7390
2 changed files with 23 additions and 27 deletions

View File

@@ -22,3 +22,23 @@ export function changeType(layer, newType) {
type: newType,
}
}
/** A {@property} in either the paint our layout {@group} has changed
* to a {@newValue}.
*/
export function changeProperty(layer, group, property, newValue) {
if(group) {
return {
...layer,
[group]: {
...layer[group],
[property]: newValue
}
}
} else {
return {
...layer,
[property]: newValue
}
}
}