mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-07 08:53:25 +01:00
17 lines
No EOL
446 B
JavaScript
17 lines
No EOL
446 B
JavaScript
import {findDiff} from 'gems/iterables';
|
|
|
|
export const selectionSynchronizer = (entity, findEntity, color) => ([old, curr]) => {
|
|
let [, toWithdraw, toMark] = findDiff(old, curr);
|
|
toWithdraw.forEach(id => {
|
|
let model = findEntity(entity, id);
|
|
if (model) {
|
|
model.ext.view.withdraw();
|
|
}
|
|
});
|
|
toMark.forEach(id => {
|
|
let model = findEntity(entity, id);
|
|
if (model) {
|
|
model.ext.view.mark(id, color);
|
|
}
|
|
});
|
|
}; |