Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Cesium.Cartesian3.distance(circle.getCenter(), position)
)
markers.updateBillboardsPositions(getMarkerPositions())
},
onDragEnd(index, position) {
onEdited()
},
},
tooltip() {
return 'Drag to change the radius'
},
}
markers.addBillboards(getMarkerPositions(), handleMarkerChanges)
this._markers = markers
// add a handler for clicking in the globe
this._globeClickhandler = new Cesium.ScreenSpaceEventHandler(
scene.canvas
)
this._globeClickhandler.setInputAction(movement => {
const pickedObject = scene.pick(movement.position)
if (!(pickedObject && pickedObject.primitive)) {
_self.setEditMode(false)
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK)
// set on top of the polygon
markers.setOnTop()
}
this._editMode = true
} else {
if (this._markers != null) {
this._markers.remove()
const tooltip = this._tooltip
const minPoints = isPolygon ? 3 : 2
let poly
if (isPolygon) {
poly = new DrawHelper.PolygonPrimitive(options)
} else {
poly = new DrawHelper.PolylinePrimitive(options)
}
poly.asynchronous = false
primitives.add(poly)
const positions = []
const markers = new _.BillboardGroup(this, defaultBillboard)
const mouseHandler = new Cesium.ScreenSpaceEventHandler(scene.canvas)
// Now wait for start
mouseHandler.setInputAction(movement => {
if (movement.position != null) {
const cartesian = scene.camera.pickEllipsoid(
movement.position,
ellipsoid
)
if (cartesian) {
// first click
if (positions.length == 0) {
positions.push(cartesian.clone())
markers.addBillboard(positions[0])
}
if (positions.length >= minPoints) {
poly.positions = positions
public constructor(scene: Cesium.Scene) {
this.scene = scene;
this.sshe = new ScreenSpaceEventHandler(scene?.canvas as HTMLCanvasElement);
}
initialize() {
this.mouseHandler = new Cesium.ScreenSpaceEventHandler(
this.options.map.scene.canvas
)
this.listenTo(
this.model,
'change:mapNorth change:mapSouth change:mapEast change:mapWest',
this.updatePrimitive
)
},
enableInput() {
}
}
});
};
this.eventCallback = function (et) { return function (e) {
var picked = _this.pick(e.position);
if (picked) {
_this.events[et].forEach(function (cb, element) {
if (pickedObjectEquals(picked, element)) {
cb(e, element);
}
});
}
}; };
this.scene = scene;
this.sshe = new ScreenSpaceEventHandler(canvas);
}
EventManager.prototype.destroy = function () {
initialize() {
this.mouseHandler = new Cesium.ScreenSpaceEventHandler(
this.options.map.scene.canvas
)
this.listenTo(
this.model,
'change:lat change:lon change:radius change:radiusUnits',
this.updatePrimitive
)
this.updatePrimitive(this.model)
},
enableInput() {
_proto.createCesiumElement = function createCesiumElement() {
if (this.props.useDefault) {
this._useDefault = true;
return this.context.cesiumWidget.screenSpaceEventHandler;
}
return new ScreenSpaceEventHandler(this.parent.canvas);
};
function setupTooltip(map, selectionInterface) {
const handler = new Cesium.ScreenSpaceEventHandler(map.scene.canvas)
handler.setInputAction(movement => {
$(componentElement).removeClass('has-feature')
if (map.scene.mode === Cesium.SceneMode.MORPHING) {
return
}
updateCoordinatesTooltip(movement.endPosition)
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE)
}
create: function (cprops, props, context) {
return new Cesium.ScreenSpaceEventHandler(context.scene.canvas);
},
unmount: function (element) {
_proto.createCesiumElement = function createCesiumElement() {
if (this.props.useDefault) {
this._useDefault = true;
return this.context.cesiumWidget.screenSpaceEventHandler;
}
return new cesium.ScreenSpaceEventHandler(this.parent.canvas);
};