mirror of
https://github.com/maputnik/editor.git
synced 2026-01-05 04:50:01 +00:00
Move change property logic to lib
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user