rlayers
Version:
React Components for OpenLayers
24 lines • 969 B
JavaScript
import { default as Modify } from 'ol/interaction/Modify';
import { default as RPointer } from './RPointer';
/** Pointer interaction for modifying existing features */
class RModify extends RPointer {
createOL(props) {
var _a;
if (!((_a = this === null || this === void 0 ? void 0 : this.context) === null || _a === void 0 ? void 0 : _a.vectorsource))
throw new Error('A Modify interaction must be part of a vector layer');
this.classProps = RModify.classProps;
return new Modify(Object.assign({ source: this.context.vectorsource }, Object.keys(props)
.filter((p) => this.classProps.includes(p))
.reduce((ac, p) => (Object.assign(Object.assign({}, ac), { [p]: props[p] })), {})));
}
}
RModify.classProps = [
'condition',
'deleteCondition',
'insertVertexCondition',
'style',
'pixelTolerance',
'hitDetection'
];
export default RModify;
//# sourceMappingURL=RModify.js.map