I am more curious why there is no 4/8/9 in ScreenSpaceEventType ?

Why?

I checked History for cesium/Source/Core/ScreenSpaceEventType.js.
I found that it was like this at the beginning.

Commits on Nov 16, 2012

I just started learning cesium.js.


Let me guess for whom these figures are reserved.

  • 4: RIGHT_DOUBLE_CLICK
  • 8: MIDDLE_DOWN
  • 9: MIDDLE_DOUBLE_CLICK

Emmm… Will it be true?

1 Like

@puxiao

Welcome to the community! :rocket:

It looks like you found the first CesiumJS commit. Do you have any specific questions related to CesiumJS?

-Sam

@sam.rothstein


I have been learning cesium.js for a month.
Emm…
Cesium.js has poor support for TypeScript.
Almost to the point where there will be an error every few lines written.


I also try to pull requests to modify the JSDoc.
https://github.com/CesiumGS/cesium/pull/9745 Merged
https://github.com/CesiumGS/cesium/pull/9783 Open
https://github.com/CesiumGS/cesium/pull/9794 Open
https://github.com/CesiumGS/cesium/pull/9795 Open


But when I found that the property type of many classes is Property, I crashed.

const model = modelRef.current

model.color = Color.RED
model.colorBlendMode = ColorBlendMode.HIGHLIGHT
model.colorBlendAmount = 0.5
model.silhouetteColor = Color.YELLOW
model.silhouetteSize = 4

PROBLEMS:

Type 'Color' is not assignable to type 'Property'.
Type 'ColorBlendMode.HIGHLIGHT' is not assignable to type 'Property | undefined'.
Type '0.5' is not assignable to type 'Property | undefined'.
Type 'Color' is not assignable to type 'Property'.
Type '4' is not assignable to type 'Property | undefined'.

I’m tired, destroy it.


When will Cesium.js be reborn for TypeScript ?

I know how to write it correctly.
Property instance I need to use.

model.color = new ConstantProperty( Color.RED );
model.silhouetteSize = new ConstantProperty( 4 )
1 Like

@puxiao

Thank you for posting an update on your question. Your new code looks mostly correct to me - although I believe you are missing a semicolon after the second line.

model.color = new ConstantProperty( Color.RED );
model.silhouetteSize = new ConstantProperty( 4 );

Let me know if you have any other questions or concerns!

-Sam