Skip to content

Commit

Permalink
Improve JSDoc/TypeScript support for Material properties
Browse files Browse the repository at this point in the history
All of the MaterialProperty constructors take primitive types in addition
to Property instances (and automatically wrap the primitive type in a
`ConstantProperty`).  The JSDoc was incorrect on this leading to sub-par
TS type definitions. Also fixed a missing optional result parameter in
the JSDoc for `EllipsoidGeodesic.interpolateUsingSurfaceDistance`.

Fixes #8898
  • Loading branch information
mramato committed Jun 3, 2020
1 parent f1aac14 commit 4620035
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Source/Core/EllipsoidGeodesic.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ EllipsoidGeodesic.prototype.interpolateUsingFraction = function (
* Provides the location of a point at the indicated distance along the geodesic.
*
* @param {Number} distance The distance from the inital point to the point of interest along the geodesic
* @param {Cartographic} result The object in which to store the result.
* @param {Cartographic} [result] The object in which to store the result.
* @returns {Cartographic} The location of the point along the geodesic.
*
* @exception {DeveloperError} start and end must be set before calling function interpolateUsingSurfaceDistance
Expand Down
6 changes: 3 additions & 3 deletions Source/DataSources/CheckerboardMaterialProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ var defaultRepeat = new Cartesian2(2.0, 2.0);
* @constructor
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.evenColor=Color.WHITE] A Property specifying the first {@link Color}.
* @param {Property} [options.oddColor=Color.BLACK] A Property specifying the second {@link Color}.
* @param {Property} [options.repeat=new Cartesian2(2.0, 2.0)] A {@link Cartesian2} Property specifying how many times the tiles repeat in each direction.
* @param {Property|Color} [options.evenColor=Color.WHITE] A Property specifying the first {@link Color}.
* @param {Property|Color} [options.oddColor=Color.BLACK] A Property specifying the second {@link Color}.
* @param {Property|Cartesian2} [options.repeat=new Cartesian2(2.0, 2.0)] A {@link Cartesian2} Property specifying how many times the tiles repeat in each direction.
*/
function CheckerboardMaterialProperty(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
Expand Down
2 changes: 1 addition & 1 deletion Source/DataSources/ColorMaterialProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Property from "./Property.js";
/**
* A {@link MaterialProperty} that maps to solid color {@link Material} uniforms.
*
* @param {Property} [color=Color.WHITE] The {@link Color} Property to be used.
* @param {Property|Color} [color=Color.WHITE] The {@link Color} Property to be used.
*
* @alias ColorMaterialProperty
* @constructor
Expand Down
10 changes: 5 additions & 5 deletions Source/DataSources/GridMaterialProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ var defaultLineThickness = new Cartesian2(1, 1);
* @alias GridMaterialProperty
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.color=Color.WHITE] A Property specifying the grid {@link Color}.
* @param {Property} [options.cellAlpha=0.1] A numeric Property specifying cell alpha values.
* @param {Property} [options.lineCount=new Cartesian2(8, 8)] A {@link Cartesian2} Property specifying the number of grid lines along each axis.
* @param {Property} [options.lineThickness=new Cartesian2(1.0, 1.0)] A {@link Cartesian2} Property specifying the thickness of grid lines along each axis.
* @param {Property} [options.lineOffset=new Cartesian2(0.0, 0.0)] A {@link Cartesian2} Property specifying starting offset of grid lines along each axis.
* @param {Property|Color} [options.color=Color.WHITE] A Property specifying the grid {@link Color}.
* @param {Property|Number} [options.cellAlpha=0.1] A numeric Property specifying cell alpha values.
* @param {Property|Cartesian2} [options.lineCount=new Cartesian2(8, 8)] A {@link Cartesian2} Property specifying the number of grid lines along each axis.
* @param {Property|Cartesian2} [options.lineThickness=new Cartesian2(1.0, 1.0)] A {@link Cartesian2} Property specifying the thickness of grid lines along each axis.
* @param {Property|Cartesian2} [options.lineOffset=new Cartesian2(0.0, 0.0)] A {@link Cartesian2} Property specifying starting offset of grid lines along each axis.
*
* @constructor
*/
Expand Down
8 changes: 4 additions & 4 deletions Source/DataSources/ImageMaterialProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ var defaultColor = Color.WHITE;
* @constructor
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.image] A Property specifying the Image, URL, Canvas, or Video.
* @param {Property} [options.repeat=new Cartesian2(1.0, 1.0)] A {@link Cartesian2} Property specifying the number of times the image repeats in each direction.
* @param {Property} [options.color=Color.WHITE] The color applied to the image
* @param {Property} [options.transparent=false] Set to true when the image has transparency (for example, when a png has transparent sections)
* @param {Property|String|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [options.image] A Property specifying the Image, URL, Canvas, or Video.
* @param {Property|Cartesian2} [options.repeat=new Cartesian2(1.0, 1.0)] A {@link Cartesian2} Property specifying the number of times the image repeats in each direction.
* @param {Property|Color} [options.color=Color.WHITE] The color applied to the image
* @param {Property|Boolean} [options.transparent=false] Set to true when the image has transparency (for example, when a png has transparent sections)
*/
function ImageMaterialProperty(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
Expand Down
2 changes: 1 addition & 1 deletion Source/DataSources/PolylineArrowMaterialProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Property from "./Property.js";
/**
* A {@link MaterialProperty} that maps to PolylineArrow {@link Material} uniforms.
*
* @param {Property} [color=Color.WHITE] The {@link Color} Property to be used.
* @param {Property|Color} [color=Color.WHITE] The {@link Color} Property to be used.
*
* @alias PolylineArrowMaterialProperty
* @constructor
Expand Down
8 changes: 4 additions & 4 deletions Source/DataSources/PolylineDashMaterialProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ var defaultDashPattern = 255.0;
* @constructor
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.color=Color.WHITE] A Property specifying the {@link Color} of the line.
* @param {Property} [options.gapColor=Color.TRANSPARENT] A Property specifying the {@link Color} of the gaps in the line.
* @param {Property} [options.dashLength=16.0] A numeric Property specifying the length of the dash pattern in pixels.
* @param {Property} [options.dashPattern=255.0] A numeric Property specifying a 16 bit pattern for the dash
* @param {Property|Color} [options.color=Color.WHITE] A Property specifying the {@link Color} of the line.
* @param {Property|Color} [options.gapColor=Color.TRANSPARENT] A Property specifying the {@link Color} of the gaps in the line.
* @param {Property|Number} [options.dashLength=16.0] A numeric Property specifying the length of the dash pattern in pixels.
* @param {Property|Number} [options.dashPattern=255.0] A numeric Property specifying a 16 bit pattern for the dash
*/
function PolylineDashMaterialProperty(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
Expand Down
6 changes: 3 additions & 3 deletions Source/DataSources/PolylineGlowMaterialProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ var defaultTaperPower = 1.0;
* @constructor
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.color=Color.WHITE] A Property specifying the {@link Color} of the line.
* @param {Property} [options.glowPower=0.25] A numeric Property specifying the strength of the glow, as a percentage of the total line width.
* @param {Property} [options.taperPower=1.0] A numeric Property specifying the strength of the tapering effect, as a percentage of the total line length. If 1.0 or higher, no taper effect is used.
* @param {Property|Color} [options.color=Color.WHITE] A Property specifying the {@link Color} of the line.
* @param {Property|Number} [options.glowPower=0.25] A numeric Property specifying the strength of the glow, as a percentage of the total line width.
* @param {Property|Number} [options.taperPower=1.0] A numeric Property specifying the strength of the tapering effect, as a percentage of the total line length. If 1.0 or higher, no taper effect is used.
*/
function PolylineGlowMaterialProperty(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
Expand Down
6 changes: 3 additions & 3 deletions Source/DataSources/PolylineOutlineMaterialProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ var defaultOutlineWidth = 1.0;
* @constructor
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.color=Color.WHITE] A Property specifying the {@link Color} of the line.
* @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline.
* @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline, in pixels.
* @param {Property|Color} [options.color=Color.WHITE] A Property specifying the {@link Color} of the line.
* @param {Property|Color} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline.
* @param {Property|Number} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline, in pixels.
*/
function PolylineOutlineMaterialProperty(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
Expand Down
10 changes: 5 additions & 5 deletions Source/DataSources/StripeMaterialProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ var defaultRepeat = 1;
* @constructor
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.orientation=StripeOrientation.HORIZONTAL] A Property specifying the {@link StripeOrientation}.
* @param {Property} [options.evenColor=Color.WHITE] A Property specifying the first {@link Color}.
* @param {Property} [options.oddColor=Color.BLACK] A Property specifying the second {@link Color}.
* @param {Property} [options.offset=0] A numeric Property specifying how far into the pattern to start the material.
* @param {Property} [options.repeat=1] A numeric Property specifying how many times the stripes repeat.
* @param {Property|StripeOrientation} [options.orientation=StripeOrientation.HORIZONTAL] A Property specifying the {@link StripeOrientation}.
* @param {Property|Color} [options.evenColor=Color.WHITE] A Property specifying the first {@link Color}.
* @param {Property|Color} [options.oddColor=Color.BLACK] A Property specifying the second {@link Color}.
* @param {Property|Number} [options.offset=0] A numeric Property specifying how far into the pattern to start the material.
* @param {Property|Number} [options.repeat=1] A numeric Property specifying how many times the stripes repeat.
*/
function StripeMaterialProperty(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
Expand Down

0 comments on commit 4620035

Please sign in to comment.