diff --git a/packages/engine/Source/DataSources/BillboardGraphics.js b/packages/engine/Source/DataSources/BillboardGraphics.js index 3145f6adb2a..7f845ded5e2 100644 --- a/packages/engine/Source/DataSources/BillboardGraphics.js +++ b/packages/engine/Source/DataSources/BillboardGraphics.js @@ -92,8 +92,7 @@ function BillboardGraphics(options) { this._disableDepthTestDistanceSubscription = undefined; this._splitDirection = undefined; this._splitDirectionSubscription = undefined; - - this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); + this.merge(options ?? defaultValue.EMPTY_OBJECT); } Object.defineProperties(BillboardGraphics.prototype, { @@ -389,57 +388,30 @@ BillboardGraphics.prototype.merge = function (source) { throw new DeveloperError("source is required."); } //>>includeEnd('debug'); - - this.show = defaultValue(this._show, source.show); - this.image = defaultValue(this._image, source.image); - this.scale = defaultValue(this._scale, source.scale); - this.pixelOffset = defaultValue(this._pixelOffset, source.pixelOffset); - this.eyeOffset = defaultValue(this._eyeOffset, source.eyeOffset); - this.horizontalOrigin = defaultValue( - this._horizontalOrigin, - source.horizontalOrigin, - ); - this.verticalOrigin = defaultValue( - this._verticalOrigin, - source.verticalOrigin, - ); - this.heightReference = defaultValue( - this._heightReference, - source.heightReference, - ); - this.color = defaultValue(this._color, source.color); - this.rotation = defaultValue(this._rotation, source.rotation); - this.alignedAxis = defaultValue(this._alignedAxis, source.alignedAxis); - this.sizeInMeters = defaultValue(this._sizeInMeters, source.sizeInMeters); - this.width = defaultValue(this._width, source.width); - this.height = defaultValue(this._height, source.height); - this.scaleByDistance = defaultValue( - this._scaleByDistance, - source.scaleByDistance, - ); - this.translucencyByDistance = defaultValue( - this._translucencyByDistance, - source.translucencyByDistance, - ); - this.pixelOffsetScaleByDistance = defaultValue( - this._pixelOffsetScaleByDistance, - source.pixelOffsetScaleByDistance, - ); - this.imageSubRegion = defaultValue( - this._imageSubRegion, - source.imageSubRegion, - ); - this.distanceDisplayCondition = defaultValue( - this._distanceDisplayCondition, - source.distanceDisplayCondition, - ); - this.disableDepthTestDistance = defaultValue( - this._disableDepthTestDistance, - source.disableDepthTestDistance, - ); - this.splitDirection = defaultValue( - this.splitDirection, - source.splitDirection, - ); + this.show = this._show ?? source.show; + this.image = this._image ?? source.image; + this.scale = this._scale ?? source.scale; + this.pixelOffset = this._pixelOffset ?? source.pixelOffset; + this.eyeOffset = this._eyeOffset ?? source.eyeOffset; + this.horizontalOrigin = this._horizontalOrigin ?? source.horizontalOrigin; + this.verticalOrigin = this._verticalOrigin ?? source.verticalOrigin; + this.heightReference = this._heightReference ?? source.heightReference; + this.color = this._color ?? source.color; + this.rotation = this._rotation ?? source.rotation; + this.alignedAxis = this._alignedAxis ?? source.alignedAxis; + this.sizeInMeters = this._sizeInMeters ?? source.sizeInMeters; + this.width = this._width ?? source.width; + this.height = this._height ?? source.height; + this.scaleByDistance = this._scaleByDistance ?? source.scaleByDistance; + this.translucencyByDistance = + this._translucencyByDistance ?? source.translucencyByDistance; + this.pixelOffsetScaleByDistance = + this._pixelOffsetScaleByDistance ?? source.pixelOffsetScaleByDistance; + this.imageSubRegion = this._imageSubRegion ?? source.imageSubRegion; + this.distanceDisplayCondition = + this._distanceDisplayCondition ?? source.distanceDisplayCondition; + this.disableDepthTestDistance = + this._disableDepthTestDistance ?? source.disableDepthTestDistance; + this.splitDirection = this.splitDirection ?? source.splitDirection; }; export default BillboardGraphics; diff --git a/packages/engine/Source/DataSources/BoxGraphics.js b/packages/engine/Source/DataSources/BoxGraphics.js index 05c4893a1b1..4b8cd59918e 100644 --- a/packages/engine/Source/DataSources/BoxGraphics.js +++ b/packages/engine/Source/DataSources/BoxGraphics.js @@ -56,7 +56,7 @@ function BoxGraphics(options) { this._distanceDisplayCondition = undefined; this._distanceDisplayConditionSubscription = undefined; - this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); + this.merge(options ?? defaultValue.EMPTY_OBJECT); } Object.defineProperties(BoxGraphics.prototype, { diff --git a/packages/engine/Source/DataSources/ConstantPositionProperty.js b/packages/engine/Source/DataSources/ConstantPositionProperty.js index 946704d563b..3069f8750fc 100644 --- a/packages/engine/Source/DataSources/ConstantPositionProperty.js +++ b/packages/engine/Source/DataSources/ConstantPositionProperty.js @@ -1,5 +1,4 @@ import Cartesian3 from "../Core/Cartesian3.js"; -import defaultValue from "../Core/defaultValue.js"; import defined from "../Core/defined.js"; import DeveloperError from "../Core/DeveloperError.js"; import Event from "../Core/Event.js"; @@ -20,7 +19,7 @@ import PositionProperty from "./PositionProperty.js"; function ConstantPositionProperty(value, referenceFrame) { this._definitionChanged = new Event(); this._value = Cartesian3.clone(value); - this._referenceFrame = defaultValue(referenceFrame, ReferenceFrame.FIXED); + this._referenceFrame = referenceFrame ?? ReferenceFrame.FIXED; } Object.defineProperties(ConstantPositionProperty.prototype, { diff --git a/packages/engine/Source/DataSources/KmlDataSource.js b/packages/engine/Source/DataSources/KmlDataSource.js index 012387fdd35..4238e91993e 100644 --- a/packages/engine/Source/DataSources/KmlDataSource.js +++ b/packages/engine/Source/DataSources/KmlDataSource.js @@ -401,10 +401,8 @@ function loadXmlFromZip(entry, uriResolver) { } function loadDataUriFromZip(entry, uriResolver) { - const mimeType = defaultValue( - MimeTypes.detectFromFilename(entry.filename), - "application/octet-stream", - ); + const mimeType = + MimeTypes.detectFromFilename(entry.filename) ?? "application/octet-stream"; return Promise.resolve(entry.getData(new zip.Data64URIWriter(mimeType))).then( function (dataUri) { uriResolver[entry.filename] = dataUri; @@ -851,8 +849,8 @@ function getIconHref( const palette = href.charAt(21); // Get the icon number - let x = defaultValue(queryNumericValue(iconNode, "x", namespaces.gx), 0); - let y = defaultValue(queryNumericValue(iconNode, "y", namespaces.gx), 0); + let x = queryNumericValue(iconNode, "x", namespaces.gx) ?? 0; + let y = queryNumericValue(iconNode, "y", namespaces.gx) ?? 0; x = Math.min(x / 32, 7); y = 7 - Math.min(y / 32, 7); const iconNum = 8 * y + x; diff --git a/packages/widgets/Source/BaseLayerPicker/BaseLayerPickerViewModel.js b/packages/widgets/Source/BaseLayerPicker/BaseLayerPickerViewModel.js index 3297b1f97a5..392f08da039 100644 --- a/packages/widgets/Source/BaseLayerPicker/BaseLayerPickerViewModel.js +++ b/packages/widgets/Source/BaseLayerPicker/BaseLayerPickerViewModel.js @@ -25,17 +25,11 @@ import createCommand from "../createCommand.js"; * @exception {DeveloperError} terrainProviderViewModels must be an array. */ function BaseLayerPickerViewModel(options) { - options = defaultValue(options, defaultValue.EMPTY_OBJECT); + options = options ?? defaultValue.EMPTY_OBJECT; const globe = options.globe; - const imageryProviderViewModels = defaultValue( - options.imageryProviderViewModels, - [], - ); - const terrainProviderViewModels = defaultValue( - options.terrainProviderViewModels, - [], - ); + const imageryProviderViewModels = options.imageryProviderViewModels ?? []; + const terrainProviderViewModels = options.terrainProviderViewModels ?? []; //>>includeStart('debug', pragmas.debug); if (!defined(globe)) { @@ -301,11 +295,8 @@ function BaseLayerPickerViewModel(options) { this._toggleDropDown = createCommand(function () { that.dropDownVisible = !that.dropDownVisible; }); - - this.selectedImagery = defaultValue( - options.selectedImageryProviderViewModel, - imageryProviderViewModels[0], - ); + this.selectedImagery = + options.selectedImageryProviderViewModel ?? imageryProviderViewModels[0]; this.selectedTerrain = options.selectedTerrainProviderViewModel; } diff --git a/packages/widgets/Source/BaseLayerPicker/ProviderViewModel.js b/packages/widgets/Source/BaseLayerPicker/ProviderViewModel.js index 0e43a3ce5f5..8ac79343f2d 100644 --- a/packages/widgets/Source/BaseLayerPicker/ProviderViewModel.js +++ b/packages/widgets/Source/BaseLayerPicker/ProviderViewModel.js @@ -1,4 +1,4 @@ -import { defaultValue, defined, DeveloperError } from "@cesium/engine"; +import { defined, DeveloperError } from "@cesium/engine"; import knockout from "../ThirdParty/knockout.js"; import createCommand from "../createCommand.js"; @@ -61,7 +61,7 @@ function ProviderViewModel(options) { */ this.iconUrl = options.iconUrl; - this._category = defaultValue(options.category, ""); + this._category = options.category ?? ""; knockout.track(this, ["name", "tooltip", "iconUrl"]); } diff --git a/packages/widgets/Source/FullscreenButton/FullscreenButtonViewModel.js b/packages/widgets/Source/FullscreenButton/FullscreenButtonViewModel.js index eca4b52bce4..7e4b3e09f41 100644 --- a/packages/widgets/Source/FullscreenButton/FullscreenButtonViewModel.js +++ b/packages/widgets/Source/FullscreenButton/FullscreenButtonViewModel.js @@ -1,5 +1,4 @@ import { - defaultValue, defined, destroyObject, DeveloperError, @@ -82,10 +81,7 @@ function FullscreenButtonViewModel(fullscreenElement, container) { knockout.getObservable(this, "isFullscreenEnabled"), ); - this._fullscreenElement = defaultValue( - getElement(fullscreenElement), - ownerDocument.body, - ); + this._fullscreenElement = getElement(fullscreenElement) ?? ownerDocument.body; this._callback = function () { tmpIsFullscreen(Fullscreen.fullscreen); diff --git a/packages/widgets/Source/Geocoder/GeocoderViewModel.js b/packages/widgets/Source/Geocoder/GeocoderViewModel.js index 44103133843..865b2e0db70 100644 --- a/packages/widgets/Source/Geocoder/GeocoderViewModel.js +++ b/packages/widgets/Source/Geocoder/GeocoderViewModel.js @@ -1,6 +1,5 @@ import { computeFlyToLocationForRectangle, - defaultValue, defined, DeveloperError, destroyObject, @@ -71,7 +70,7 @@ function GeocoderViewModel(options) { }); this._searchCommand = createCommand(function (geocodeType) { - geocodeType = defaultValue(geocodeType, GeocodeType.SEARCH); + geocodeType = geocodeType ?? GeocodeType.SEARCH; that._focusTextbox = false; if (defined(that._selectedSuggestion)) { that.activateSuggestion(that._selectedSuggestion); @@ -153,16 +152,14 @@ function GeocoderViewModel(options) { * @type {boolean} * @default true */ - this.autoComplete = defaultValue(options.autocomplete, true); + this.autoComplete = options.autocomplete ?? true; /** * Gets and sets the command called when a geocode destination is found * @type {Geocoder.DestinationFoundFunction} */ - this.destinationFound = defaultValue( - options.destinationFound, - GeocoderViewModel.flyToDestination, - ); + this.destinationFound = + options.destinationFound ?? GeocoderViewModel.flyToDestination; this._focusTextbox = false; diff --git a/packages/widgets/Source/InspectorShared.js b/packages/widgets/Source/InspectorShared.js index 8fe28ca7b7c..eafb8151c60 100644 --- a/packages/widgets/Source/InspectorShared.js +++ b/packages/widgets/Source/InspectorShared.js @@ -1,4 +1,4 @@ -import { Check, defaultValue, defined } from "@cesium/engine"; +import { Check, defined } from "@cesium/engine"; /** * A static class with helper functions used by CesiumInspector, Cesium3DTilesInspector, and VoxelInspector @@ -109,7 +109,7 @@ InspectorShared.createRangeInput = function ( Check.typeOf.number("max", max); //>>includeEnd('debug'); - inputValueBinding = defaultValue(inputValueBinding, sliderValueBinding); + inputValueBinding = inputValueBinding ?? sliderValueBinding; const input = document.createElement("input"); input.setAttribute("data-bind", `value: ${inputValueBinding}`); input.type = "number"; @@ -118,7 +118,7 @@ InspectorShared.createRangeInput = function ( slider.type = "range"; slider.min = min; slider.max = max; - slider.step = defaultValue(step, "any"); + slider.step = step ?? "any"; slider.setAttribute( "data-bind", `valueUpdate: "input", value: ${sliderValueBinding}`, diff --git a/packages/widgets/Source/NavigationHelpButton/NavigationHelpButton.js b/packages/widgets/Source/NavigationHelpButton/NavigationHelpButton.js index 1babb8aa1c6..861861f1ef4 100644 --- a/packages/widgets/Source/NavigationHelpButton/NavigationHelpButton.js +++ b/packages/widgets/Source/NavigationHelpButton/NavigationHelpButton.js @@ -1,6 +1,5 @@ import { buildModuleUrl, - defaultValue, defined, destroyObject, DeveloperError, @@ -42,11 +41,7 @@ function NavigationHelpButton(options) { const viewModel = new NavigationHelpButtonViewModel(); - const showInsructionsDefault = defaultValue( - options.instructionsInitiallyVisible, - false, - ); - viewModel.showInstructions = showInsructionsDefault; + viewModel.showInstructions = options.instructionsInitiallyVisible ?? false; viewModel._svgPath = "M16,1.466C7.973,1.466,1.466,7.973,1.466,16c0,8.027,6.507,14.534,14.534,14.534c8.027,0,14.534-6.507,14.534-14.534C30.534,7.973,24.027,1.466,16,1.466z M17.328,24.371h-2.707v-2.596h2.707V24.371zM17.328,19.003v0.858h-2.707v-1.057c0-3.19,3.63-3.696,3.63-5.963c0-1.034-0.924-1.826-2.134-1.826c-1.254,0-2.354,0.924-2.354,0.924l-1.541-1.915c0,0,1.519-1.584,4.137-1.584c2.487,0,4.796,1.54,4.796,4.136C21.156,16.208,17.328,16.627,17.328,19.003z"; diff --git a/packages/widgets/Source/PerformanceWatchdog/PerformanceWatchdogViewModel.js b/packages/widgets/Source/PerformanceWatchdog/PerformanceWatchdogViewModel.js index 653c344c088..c13efea226b 100644 --- a/packages/widgets/Source/PerformanceWatchdog/PerformanceWatchdogViewModel.js +++ b/packages/widgets/Source/PerformanceWatchdog/PerformanceWatchdogViewModel.js @@ -1,5 +1,4 @@ import { - defaultValue, defined, destroyObject, DeveloperError, @@ -33,10 +32,11 @@ function PerformanceWatchdogViewModel(options) { * Gets or sets the message to display when a low frame rate is detected. This string will be interpreted as HTML. * @type {string} */ - this.lowFrameRateMessage = defaultValue( - options.lowFrameRateMessage, - "This application appears to be performing poorly on your system. Please try using a different web browser or updating your video drivers.", - ); + + this.lowFrameRateMessage = + options.lowFrameRateMessage ?? + "This application appears to be performing poorly on your system. " + + "Please try using a different web browser or updating your video drivers."; /** * Gets or sets a value indicating whether the low frame rate message has previously been dismissed by the user. If it has diff --git a/packages/widgets/Source/SceneModePicker/SceneModePickerViewModel.js b/packages/widgets/Source/SceneModePicker/SceneModePickerViewModel.js index 33884b8902f..84f2a48f954 100644 --- a/packages/widgets/Source/SceneModePicker/SceneModePickerViewModel.js +++ b/packages/widgets/Source/SceneModePicker/SceneModePickerViewModel.js @@ -1,5 +1,4 @@ import { - defaultValue, defined, destroyObject, DeveloperError, @@ -36,7 +35,7 @@ function SceneModePickerViewModel(scene, duration) { this._eventHelper = new EventHelper(); this._eventHelper.add(scene.morphStart, morphStart); - this._duration = defaultValue(duration, 2.0); + this._duration = duration ?? 2.0; /** * Gets or sets the current SceneMode. This property is observable. diff --git a/packages/widgets/Source/SelectionIndicator/SelectionIndicatorViewModel.js b/packages/widgets/Source/SelectionIndicator/SelectionIndicatorViewModel.js index e5d5c63137b..0156030dace 100644 --- a/packages/widgets/Source/SelectionIndicator/SelectionIndicatorViewModel.js +++ b/packages/widgets/Source/SelectionIndicator/SelectionIndicatorViewModel.js @@ -1,6 +1,5 @@ import { Cartesian2, - defaultValue, defined, DeveloperError, EasingFunction, @@ -43,7 +42,7 @@ function SelectionIndicatorViewModel( this._screenPositionX = offScreen; this._screenPositionY = offScreen; this._tweens = scene.tweens; - this._container = defaultValue(container, document.body); + this._container = container ?? document.body; this._selectionIndicatorElement = selectionIndicatorElement; this._scale = 1; diff --git a/packages/widgets/Source/Timeline/TimelineHighlightRange.js b/packages/widgets/Source/Timeline/TimelineHighlightRange.js index de11a00d388..81a8554ddea 100644 --- a/packages/widgets/Source/Timeline/TimelineHighlightRange.js +++ b/packages/widgets/Source/Timeline/TimelineHighlightRange.js @@ -1,4 +1,4 @@ -import { defaultValue, JulianDate } from "@cesium/engine"; +import { JulianDate } from "@cesium/engine"; /** * @private @@ -6,7 +6,7 @@ import { defaultValue, JulianDate } from "@cesium/engine"; function TimelineHighlightRange(color, heightInPx, base) { this._color = color; this._height = heightInPx; - this._base = defaultValue(base, 0); + this._base = base ?? 0; } TimelineHighlightRange.prototype.getHeight = function () { diff --git a/packages/widgets/Source/ToggleButtonViewModel.js b/packages/widgets/Source/ToggleButtonViewModel.js index b8f339a16e5..fc5ce62b807 100644 --- a/packages/widgets/Source/ToggleButtonViewModel.js +++ b/packages/widgets/Source/ToggleButtonViewModel.js @@ -20,21 +20,21 @@ function ToggleButtonViewModel(command, options) { this._command = command; - options = defaultValue(options, defaultValue.EMPTY_OBJECT); + options = options ?? defaultValue.EMPTY_OBJECT; /** * Gets or sets whether the button is currently toggled. This property is observable. * @type {boolean} * @default false */ - this.toggled = defaultValue(options.toggled, false); + this.toggled = options.toggled ?? false; /** * Gets or sets the button's tooltip. This property is observable. * @type {string} * @default '' */ - this.tooltip = defaultValue(options.tooltip, ""); + this.tooltip = options.tooltip ?? ""; knockout.track(this, ["toggled", "tooltip"]); } diff --git a/packages/widgets/Source/VRButton/VRButtonViewModel.js b/packages/widgets/Source/VRButton/VRButtonViewModel.js index 21cc736d081..55e3e8efb58 100644 --- a/packages/widgets/Source/VRButton/VRButtonViewModel.js +++ b/packages/widgets/Source/VRButton/VRButtonViewModel.js @@ -1,5 +1,4 @@ import { - defaultValue, defined, destroyObject, DeveloperError, @@ -156,7 +155,7 @@ function VRButtonViewModel(scene, vrElement) { knockout.getObservable(this, "isVREnabled"), ); - this._vrElement = defaultValue(getElement(vrElement), document.body); + this._vrElement = getElement(vrElement) ?? document.body; this._callback = function () { if (!Fullscreen.fullscreen && isVRMode()) { diff --git a/packages/widgets/Source/Viewer/Viewer.js b/packages/widgets/Source/Viewer/Viewer.js index 26983bdc381..f51153e747b 100644 --- a/packages/widgets/Source/Viewer/Viewer.js +++ b/packages/widgets/Source/Viewer/Viewer.js @@ -116,7 +116,7 @@ function getCesium3DTileFeatureName(feature) { function pickEntity(viewer, e) { const picked = viewer.scene.pick(e.position); if (defined(picked)) { - const id = defaultValue(picked.id, picked.primitive.id); + const id = picked.id ?? picked.primitive.id; if (id instanceof Entity) { return id; } @@ -416,7 +416,7 @@ function Viewer(container, options) { //>>includeEnd('debug'); container = getElement(container); - options = defaultValue(options, defaultValue.EMPTY_OBJECT); + options = options ?? defaultValue.EMPTY_OBJECT; const createBaseLayerPicker = (!defined(options.globe) || options.globe !== false) && @@ -463,7 +463,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to viewerContainer.appendChild(bottomContainer); - const scene3DOnly = defaultValue(options.scene3DOnly, false); + const scene3DOnly = options.scene3DOnly ?? false; let clock; let clockViewModel; @@ -653,14 +653,12 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to let baseLayerPicker; let baseLayerPickerDropDown; if (createBaseLayerPicker) { - const imageryProviderViewModels = defaultValue( - options.imageryProviderViewModels, - createDefaultImageryProviderViewModels(), - ); - const terrainProviderViewModels = defaultValue( - options.terrainProviderViewModels, - createDefaultTerrainProviderViewModels(), - ); + const imageryProviderViewModels = + options.imageryProviderViewModels ?? + createDefaultImageryProviderViewModels(); + const terrainProviderViewModels = + options.terrainProviderViewModels ?? + createDefaultTerrainProviderViewModels(); baseLayerPicker = new BaseLayerPicker(toolbar, { globe: scene.globe, @@ -737,10 +735,8 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to } navigationHelpButton = new NavigationHelpButton({ container: toolbar, - instructionsInitiallyVisible: defaultValue( - options.navigationInstructionsInitiallyVisible, - showNavHelp, - ), + instructionsInitiallyVisible: + options.navigationInstructionsInitiallyVisible ?? showNavHelp, }); } @@ -841,10 +837,8 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to this._vrSubscription = vrSubscription; this._vrModeSubscription = vrModeSubscription; this._dataSourceChangedListeners = {}; - this._automaticallyTrackDataSourceClocks = defaultValue( - options.automaticallyTrackDataSourceClocks, - true, - ); + this._automaticallyTrackDataSourceClocks = + options.automaticallyTrackDataSourceClocks ?? true; this._container = container; this._bottomContainer = bottomContainer; this._element = viewerContainer; @@ -1948,10 +1942,7 @@ Viewer.prototype._onTick = function (clock) { this.trackedEntity === this.selectedEntity; if (showSelection) { - infoBoxViewModel.titleText = defaultValue( - selectedEntity.name, - selectedEntity.id, - ); + infoBoxViewModel.titleText = selectedEntity.name ?? selectedEntity.id; infoBoxViewModel.description = Property.getValueOrDefault( selectedEntity.description, time, @@ -2213,7 +2204,7 @@ function zoomToOrFly(that, zoomTarget, options, isFlight) { } //If zoomTarget is an EntityCollection, this will retrieve the array - zoomTarget = defaultValue(zoomTarget.values, zoomTarget); + zoomTarget = zoomTarget.values ?? zoomTarget; //If zoomTarget is a DataSource, this will retrieve the array. if (defined(zoomTarget.entities)) { @@ -2263,7 +2254,7 @@ function updateZoomTarget(viewer) { const scene = viewer.scene; const camera = scene.camera; - const zoomOptions = defaultValue(viewer._zoomOptions, {}); + const zoomOptions = viewer._zoomOptions ?? defaultValue.EMPTY_OBJECT; let options; function zoomToBoundingSphere(boundingSphere) { // If offset was originally undefined then give it base value instead of empty object diff --git a/packages/widgets/Source/Viewer/viewerDragDropMixin.js b/packages/widgets/Source/Viewer/viewerDragDropMixin.js index 6e11d882c7b..32db22f5ed8 100644 --- a/packages/widgets/Source/Viewer/viewerDragDropMixin.js +++ b/packages/widgets/Source/Viewer/viewerDragDropMixin.js @@ -66,15 +66,15 @@ function viewerDragDropMixin(viewer, options) { } //>>includeEnd('debug'); - options = defaultValue(options, defaultValue.EMPTY_OBJECT); + options = options ?? defaultValue.EMPTY_OBJECT; //Local variables to be closed over by defineProperties. let dropEnabled = true; - let flyToOnDrop = defaultValue(options.flyToOnDrop, true); + let flyToOnDrop = options.flyToOnDrop ?? true; const dropError = new Event(); - let clearOnDrop = defaultValue(options.clearOnDrop, true); - let dropTarget = defaultValue(options.dropTarget, viewer.container); - let clampToGround = defaultValue(options.clampToGround, true); + let clearOnDrop = options.clearOnDrop ?? true; + let dropTarget = options.dropTarget ?? viewer.container; + let clampToGround = options.clampToGround ?? true; let proxy = options.proxy; dropTarget = getElement(dropTarget); diff --git a/packages/widgets/Source/Viewer/viewerPerformanceWatchdogMixin.js b/packages/widgets/Source/Viewer/viewerPerformanceWatchdogMixin.js index accaf51a8d5..c6b557a8686 100644 --- a/packages/widgets/Source/Viewer/viewerPerformanceWatchdogMixin.js +++ b/packages/widgets/Source/Viewer/viewerPerformanceWatchdogMixin.js @@ -28,7 +28,7 @@ function viewerPerformanceWatchdogMixin(viewer, options) { } //>>includeEnd('debug'); - options = defaultValue(options, defaultValue.EMPTY_OBJECT); + options = options ?? defaultValue.EMPTY_OBJECT; const performanceWatchdog = new PerformanceWatchdog({ scene: viewer.scene, diff --git a/packages/widgets/Source/createCommand.js b/packages/widgets/Source/createCommand.js index 305905a3c9c..f98d7ecacac 100644 --- a/packages/widgets/Source/createCommand.js +++ b/packages/widgets/Source/createCommand.js @@ -1,4 +1,4 @@ -import { defaultValue, defined, DeveloperError, Event } from "@cesium/engine"; +import { defined, DeveloperError, Event } from "@cesium/engine"; import knockout from "./ThirdParty/knockout.js"; /** @@ -21,7 +21,7 @@ function createCommand(func, canExecute) { } //>>includeEnd('debug'); - canExecute = defaultValue(canExecute, true); + canExecute = canExecute ?? true; const beforeExecute = new Event(); const afterExecute = new Event(); diff --git a/packages/widgets/Specs/createViewer.js b/packages/widgets/Specs/createViewer.js index 6a55487f99a..bcc65f813c6 100644 --- a/packages/widgets/Specs/createViewer.js +++ b/packages/widgets/Specs/createViewer.js @@ -1,12 +1,11 @@ -import { defaultValue } from "@cesium/engine"; import { Viewer } from "../index.js"; import getWebGLStub from "../../../Specs/getWebGLStub.js"; function createViewer(container, options) { - options = defaultValue(options, {}); - options.contextOptions = defaultValue(options.contextOptions, {}); - options.contextOptions.webgl = defaultValue(options.contextOptions.webgl, {}); + options = options ?? {}; + options.contextOptions = options.contextOptions ?? {}; + options.contextOptions.webgl = options.contextOptions.webgl ?? {}; if (!!window.webglStub) { options.contextOptions.getWebGLStub = getWebGLStub; }