Skip to content

Commit

Permalink
fix: cannot update Label props (close #92)
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Jul 3, 2019
1 parent 6e3fd80 commit f6f5a0a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Label/Label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface LabelCesiumProps {
export interface LabelProps extends LabelCesiumProps, EventProps<Cesium.Label> {}

export interface LabelContext {
labelCollection?: Cesium.LabelCollection;
labelCollection: Cesium.LabelCollection;
__RESIUM_EVENT_MANAGER?: EventManager;
}

Expand Down Expand Up @@ -79,15 +79,12 @@ const cesiumProps: (keyof LabelCesiumProps)[] = [
const Label = createCesiumComponent<Cesium.Label, LabelProps, LabelContext>({
name: "Label",
create(cprops, props, context) {
return new (Cesium.Label as any)(cprops, context.labelCollection);
return context.labelCollection.add(cprops);
},
mount(element, context, props) {
if (context.__RESIUM_EVENT_MANAGER) {
context.__RESIUM_EVENT_MANAGER.setEvents(element, props);
}
if (context.labelCollection) {
context.labelCollection.add(element);
}
},
unmount(element, context) {
if (context.__RESIUM_EVENT_MANAGER) {
Expand Down

0 comments on commit f6f5a0a

Please sign in to comment.