Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
testDrag() {
this.eventManager
.register({event: CesiumEvent.LEFT_CLICK_DRAG, pick: PickOptions.PICK_FIRST, entityType: AcEntity})
.pipe(
filter(result => result.entities && result.entities[0].name === 'Drag me'),
tap(result => {
// disable camera rotation when dragging
if (!result.movement.drop) {
this.cameraService.enableInputs(false);
} else {
this.cameraService.enableInputs(true);
}
}),
map(result => {
const entity = result.entities[0];
const nextPos = this.geoConverter.screenToCartesian3(result.movement.endPosition, false);
if (nextPos) {
entity.position = nextPos;
}