UNPKG

680 BJavaScriptView Raw
1const featuresAt = require('./features_at');
2const Constants = require('../constants');
3
4module.exports = function getFeatureAtAndSetCursors(event, ctx) {
5 const features = featuresAt(event, null, ctx);
6 const classes = { mouse: Constants.cursors.NONE };
7
8 if (features[0]) {
9 classes.mouse = (features[0].properties.active === Constants.activeStates.ACTIVE) ?
10 Constants.cursors.MOVE : Constants.cursors.POINTER;
11 classes.feature = features[0].properties.meta;
12 }
13
14 if (ctx.events.currentModeName().indexOf('draw') !== -1) {
15 classes.mouse = Constants.cursors.ADD;
16 }
17
18 ctx.ui.queueMapClasses(classes);
19 ctx.ui.updateMapClasses();
20
21 return features[0];
22};