jsketcher/web/app/cad/scene/selectionMarker/selectionSynchronizer.js
2022-06-25 15:19:48 -07:00

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);
}
});
};