diff --git a/Specs/DomEventSimulator.js b/Specs/DomEventSimulator.js index 52a69719fda..7a22313d691 100644 --- a/Specs/DomEventSimulator.js +++ b/Specs/DomEventSimulator.js @@ -185,94 +185,34 @@ function createPointerEvent(type, options) { options = options ?? Frozen.EMPTY_OBJECT; let event; - if (FeatureDetection.isInternetExplorer()) { - const canBubble = options.canBubble ?? true; - const cancelable = options.cancelable ?? true; - const view = options.view ?? window; - const detail = options.detail ?? 0; - const screenX = options.screenX ?? 0; - const screenY = options.screenY ?? 0; - const clientX = options.clientX ?? 0; - const clientY = options.clientY ?? 0; - const ctrlKey = options.ctrlKey ?? false; - const altKey = options.altKey ?? false; - const shiftKey = options.shiftKey ?? false; - const metaKey = options.metaKey ?? false; - const button = options.button ?? 0; - const relatedTarget = options.relatedTarget ?? null; - const offsetX = options.offsetX ?? 0; - const offsetY = options.offsetY ?? 0; - const width = options.width ?? 0; - const height = options.height ?? 0; - const pressure = options.pressure ?? 0; - const rotation = options.rotation ?? 0; - const tiltX = options.tiltX ?? 0; - const tiltY = options.tiltY ?? 0; - const pointerId = options.pointerId ?? 1; - const pointerType = options.pointerType ?? 0; - const hwTimestamp = options.hwTimestamp ?? 0; - const isPrimary = options.isPrimary ?? 0; - - event = document.createEvent("PointerEvent"); - event.initPointerEvent( - type, - canBubble, - cancelable, - view, - detail, - screenX, - screenY, - clientX, - clientY, - ctrlKey, - altKey, - shiftKey, - metaKey, - button, - relatedTarget, - offsetX, - offsetY, - width, - height, - pressure, - rotation, - tiltX, - tiltY, - pointerId, - pointerType, - hwTimestamp, - isPrimary, - ); - } else { - event = new window.PointerEvent(type, { - canBubble: options.canBubble ?? true, - cancelable: options.cancelable ?? true, - view: options.view ?? window, - detail: options.detail ?? 0, - screenX: options.screenX ?? 0, - screenY: options.screenY ?? 0, - clientX: options.clientX ?? 0, - clientY: options.clientY ?? 0, - ctrlKey: options.ctrlKey ?? false, - altKey: options.altKey ?? false, - shiftKey: options.shiftKey ?? false, - metaKey: options.metaKey ?? false, - button: options.button ?? 0, - relatedTarget: options.relatedTarget ?? null, - offsetX: options.offsetX ?? 0, - offsetY: options.offsetY ?? 0, - width: options.width ?? 0, - height: options.height ?? 0, - pressure: options.pressure ?? 0, - rotation: options.rotation ?? 0, - tiltX: options.tiltX ?? 0, - tiltY: options.tiltY ?? 0, - pointerId: options.pointerId ?? 1, - pointerType: options.pointerType ?? 0, - hwTimestamp: options.hwTimestamp ?? 0, - isPrimary: options.isPrimary ?? 0, - }); - } + event = new window.PointerEvent(type, { + canBubble: options.canBubble ?? true, + cancelable: options.cancelable ?? true, + view: options.view ?? window, + detail: options.detail ?? 0, + screenX: options.screenX ?? 0, + screenY: options.screenY ?? 0, + clientX: options.clientX ?? 0, + clientY: options.clientY ?? 0, + ctrlKey: options.ctrlKey ?? false, + altKey: options.altKey ?? false, + shiftKey: options.shiftKey ?? false, + metaKey: options.metaKey ?? false, + button: options.button ?? 0, + relatedTarget: options.relatedTarget ?? null, + offsetX: options.offsetX ?? 0, + offsetY: options.offsetY ?? 0, + width: options.width ?? 0, + height: options.height ?? 0, + pressure: options.pressure ?? 0, + rotation: options.rotation ?? 0, + tiltX: options.tiltX ?? 0, + tiltY: options.tiltY ?? 0, + pointerId: options.pointerId ?? 1, + pointerType: options.pointerType ?? 0, + hwTimestamp: options.hwTimestamp ?? 0, + isPrimary: options.isPrimary ?? 0, + }); return event; } diff --git a/packages/engine/Source/Core/FeatureDetection.js b/packages/engine/Source/Core/FeatureDetection.js index 78064fda211..1cc1701b2e9 100644 --- a/packages/engine/Source/Core/FeatureDetection.js +++ b/packages/engine/Source/Core/FeatureDetection.js @@ -88,36 +88,6 @@ function webkitVersion() { return isWebkit() && webkitVersionResult; } -let isInternetExplorerResult; -let internetExplorerVersionResult; -function isInternetExplorer() { - if (!defined(isInternetExplorerResult)) { - isInternetExplorerResult = false; - - let fields; - if (theNavigator.appName === "Microsoft Internet Explorer") { - fields = /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(theNavigator.userAgent); - if (fields !== null) { - isInternetExplorerResult = true; - internetExplorerVersionResult = extractVersion(fields[1]); - } - } else if (theNavigator.appName === "Netscape") { - fields = /Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec( - theNavigator.userAgent, - ); - if (fields !== null) { - isInternetExplorerResult = true; - internetExplorerVersionResult = extractVersion(fields[1]); - } - } - } - return isInternetExplorerResult; -} - -function internetExplorerVersion() { - return isInternetExplorer() && internetExplorerVersionResult; -} - let isEdgeResult; let edgeVersionResult; function isEdge() { @@ -303,8 +273,6 @@ const FeatureDetection = { safariVersion: safariVersion, isWebkit: isWebkit, webkitVersion: webkitVersion, - isInternetExplorer: isInternetExplorer, - internetExplorerVersion: internetExplorerVersion, isEdge: isEdge, edgeVersion: edgeVersion, isFirefox: isFirefox, diff --git a/packages/engine/Source/Core/GeometryFactory.js b/packages/engine/Source/Core/GeometryFactory.js index 10ee22d3cf1..519c21573f5 100644 --- a/packages/engine/Source/Core/GeometryFactory.js +++ b/packages/engine/Source/Core/GeometryFactory.js @@ -1,21 +1,70 @@ import DeveloperError from "../Core/DeveloperError.js"; /** - * Base class for all geometry creation utility classes that can be passed to {@link GeometryInstance} - * for asynchronous geometry creation. + * Describes a geometry type that can be converted into a {@link Geometry}. + *
+ * Implementations of this interface are the core geometry "description" classes
+ * such as {@link BoxGeometry}, {@link RectangleGeometry},
+ * {@link EllipsoidGeometry}, and other classes with a static
+ * createGeometry function. Instances of these classes can be
+ * passed to {@link GeometryInstance} and {@link Primitive} to have their
+ * vertices and indices created either asynchronously on a web worker or
+ * synchronously on the main thread.
+ *
+ * This type describes an interface and is not intended to be instantiated + * directly. + *
* + * @alias GeometryFactory * @constructor - * @class * @abstract + * + * @see BoxGeometry + * @see BoxOutlineGeometry + * @see CircleGeometry + * @see CircleOutlineGeometry + * @see CoplanarPolygonGeometry + * @see CoplanarPolygonOutlineGeometry + * @see CorridorGeometry + * @see CorridorOutlineGeometry + * @see CylinderGeometry + * @see CylinderOutlineGeometry + * @see EllipseGeometry + * @see EllipseOutlineGeometry + * @see EllipsoidGeometry + * @see EllipsoidOutlineGeometry + * @see FrustumGeometry + * @see FrustumOutlineGeometry + * @see GroundPolylineGeometry + * @see PlaneGeometry + * @see PlaneOutlineGeometry + * @see PolygonGeometry + * @see PolygonOutlineGeometry + * @see PolylineGeometry + * @see PolylineVolumeGeometry + * @see PolylineVolumeOutlineGeometry + * @see RectangleGeometry + * @see RectangleOutlineGeometry + * @see SimplePolylineGeometry + * @see SphereGeometry + * @see SphereOutlineGeometry + * @see WallGeometry + * @see WallOutlineGeometry */ function GeometryFactory() { DeveloperError.throwInstantiationError(); } /** - * Returns a geometry. + * Creates a {@link Geometry} from a geometry description. + *+ * Concrete geometry classes (for example {@link RectangleGeometry}) implement + * this function as a static method that takes an instance of the corresponding + * geometry description and returns the computed vertices and indices. + *
* - * @param {GeometryFactory} geometryFactory A description of the circle. + * @param {GeometryFactory} geometryFactory The geometry description to create. * @returns {Geometry|undefined} The computed vertices and indices. */ GeometryFactory.createGeometry = function (geometryFactory) { diff --git a/packages/engine/Source/Core/GeometryInstance.js b/packages/engine/Source/Core/GeometryInstance.js index d5316efdc7c..45958565c1a 100644 --- a/packages/engine/Source/Core/GeometryInstance.js +++ b/packages/engine/Source/Core/GeometryInstance.js @@ -14,6 +14,12 @@ import Matrix4 from "./Matrix4.js"; * * @param {object} options Object with the following properties: * @param {Geometry|GeometryFactory} options.geometry The geometry to instance. + * When a {@link Geometry} is passed, it will be used directly. When an + * object implementing {@link GeometryFactory} is passed (for example an + * instance of {@link RectangleGeometry} or {@link EllipsoidGeometry}), + * the actual geometry will be created either asynchronously on a web + * worker or synchronously on the main thread depending on the + * {@link Primitive} options. * @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The model matrix that transforms to transform the geometry from model to world coordinates. * @param {object} [options.id] A user-defined object to return when the instance is picked with {@link Scene#pick} or get/set per-instance attributes with {@link Primitive#getGeometryInstanceAttributes}. * @param {object} [options.attributes] Per-instance attributes like a show or color attribute shown in the example below. diff --git a/packages/engine/Source/Core/ScreenSpaceEventHandler.js b/packages/engine/Source/Core/ScreenSpaceEventHandler.js index c7bec36ff71..aec885e48e0 100644 --- a/packages/engine/Source/Core/ScreenSpaceEventHandler.js +++ b/packages/engine/Source/Core/ScreenSpaceEventHandler.js @@ -53,14 +53,10 @@ function registerListener(screenSpaceEventHandler, domType, element, callback) { callback(screenSpaceEventHandler, e); } - if (FeatureDetection.isInternetExplorer()) { - element.addEventListener(domType, listener, false); - } else { - element.addEventListener(domType, listener, { + element.addEventListener(domType, listener, { capture: false, passive: false, }); - } screenSpaceEventHandler._removalFunctions.push(function () { element.removeEventListener(domType, listener, false); diff --git a/packages/engine/Source/Scene/PolylineCollection.js b/packages/engine/Source/Scene/PolylineCollection.js index c216bbe30ce..6b8bdac684c 100644 --- a/packages/engine/Source/Scene/PolylineCollection.js +++ b/packages/engine/Source/Scene/PolylineCollection.js @@ -1294,9 +1294,7 @@ PolylineBucket.prototype.updateShader = function ( defines.push("POLYLINE_DASH"); } - if (!FeatureDetection.isInternetExplorer()) { - defines.push("CLIP_POLYLINE"); - } + defines.push("CLIP_POLYLINE"); const fs = new ShaderSource({ defines: defines, diff --git a/packages/engine/Source/Scene/PolylineColorAppearance.js b/packages/engine/Source/Scene/PolylineColorAppearance.js index b5d6af27a5d..27f5310463a 100644 --- a/packages/engine/Source/Scene/PolylineColorAppearance.js +++ b/packages/engine/Source/Scene/PolylineColorAppearance.js @@ -9,9 +9,7 @@ import Appearance from "./Appearance.js"; let defaultVertexShaderSource = `${PolylineCommon}\n${PolylineColorAppearanceVS}`; const defaultFragmentShaderSource = PerInstanceFlatColorAppearanceFS; -if (!FeatureDetection.isInternetExplorer()) { - defaultVertexShaderSource = `#define CLIP_POLYLINE \n${defaultVertexShaderSource}`; -} +defaultVertexShaderSource = `#define CLIP_POLYLINE \n${defaultVertexShaderSource}`; /** * An appearance for {@link GeometryInstance} instances with color attributes and diff --git a/packages/engine/Source/Scene/PolylineMaterialAppearance.js b/packages/engine/Source/Scene/PolylineMaterialAppearance.js index 4f6a79b6156..e496251ebd4 100644 --- a/packages/engine/Source/Scene/PolylineMaterialAppearance.js +++ b/packages/engine/Source/Scene/PolylineMaterialAppearance.js @@ -11,9 +11,7 @@ import Material from "./Material.js"; let defaultVertexShaderSource = `${PolylineCommon}\n${PolylineMaterialAppearanceVS}`; const defaultFragmentShaderSource = PolylineFS; -if (!FeatureDetection.isInternetExplorer()) { - defaultVertexShaderSource = `#define CLIP_POLYLINE \n${defaultVertexShaderSource}`; -} +defaultVertexShaderSource = `#define CLIP_POLYLINE \n${defaultVertexShaderSource}`; /** * An appearance for {@link PolylineGeometry} that supports shading with materials. diff --git a/packages/engine/Source/Scene/ShadowMap.js b/packages/engine/Source/Scene/ShadowMap.js index 6b99ad1af27..198a908d322 100644 --- a/packages/engine/Source/Scene/ShadowMap.js +++ b/packages/engine/Source/Scene/ShadowMap.js @@ -145,7 +145,6 @@ function ShadowMap(options) { // Re-enable once https://github.com/CesiumGS/cesium/issues/4560 is resolved. let polygonOffsetSupported = true; if ( - FeatureDetection.isInternetExplorer() || FeatureDetection.isEdge() || ((FeatureDetection.isChrome() || FeatureDetection.isFirefox()) && FeatureDetection.isWindows() && diff --git a/packages/engine/Source/Scene/Vector3DTileClampedPolylines.js b/packages/engine/Source/Scene/Vector3DTileClampedPolylines.js index e89eb1711f3..05a6732075c 100644 --- a/packages/engine/Source/Scene/Vector3DTileClampedPolylines.js +++ b/packages/engine/Source/Scene/Vector3DTileClampedPolylines.js @@ -559,7 +559,7 @@ function createShaders(primitive, context) { const vs = new ShaderSource({ defines: [ "VECTOR_TILE", - !FeatureDetection.isInternetExplorer() ? "CLIP_POLYLINE" : "", + "CLIP_POLYLINE", ], sources: [PolylineCommon, vsSource], }); diff --git a/packages/engine/Source/Scene/Vector3DTilePolylines.js b/packages/engine/Source/Scene/Vector3DTilePolylines.js index 1aaedc3b758..89bf75cae58 100644 --- a/packages/engine/Source/Scene/Vector3DTilePolylines.js +++ b/packages/engine/Source/Scene/Vector3DTilePolylines.js @@ -458,7 +458,7 @@ function createShaders(primitive, context) { const vs = new ShaderSource({ defines: [ "VECTOR_TILE", - !FeatureDetection.isInternetExplorer() ? "CLIP_POLYLINE" : "", + "CLIP_POLYLINE", ], sources: [PolylineCommon, vsSource], }); diff --git a/packages/engine/Specs/Core/FeatureDetectionSpec.js b/packages/engine/Specs/Core/FeatureDetectionSpec.js index f6d8fffbd26..91e4c227463 100644 --- a/packages/engine/Specs/Core/FeatureDetectionSpec.js +++ b/packages/engine/Specs/Core/FeatureDetectionSpec.js @@ -86,20 +86,7 @@ describe("Core/FeatureDetection", function () { } }); - it("detects Internet Explorer", function () { - const isInternetExplorer = FeatureDetection.isInternetExplorer(); - expect(typeof isInternetExplorer).toEqual("boolean"); - - if (isInternetExplorer) { - const internetExplorerVersion = - FeatureDetection.internetExplorerVersion(); - checkVersionArray(internetExplorerVersion); - - console.log( - `detected Internet Explorer ${internetExplorerVersion.join(".")}`, - ); - } - }); + it("detects Edge", function () { const isEdge = FeatureDetection.isEdge(); diff --git a/packages/engine/Specs/Core/FullscreenSpec.js b/packages/engine/Specs/Core/FullscreenSpec.js index f3ddd8945bd..630ce3f5a27 100644 --- a/packages/engine/Specs/Core/FullscreenSpec.js +++ b/packages/engine/Specs/Core/FullscreenSpec.js @@ -50,23 +50,21 @@ describe("Core/Fullscreen", function () { } }); - if (!FeatureDetection.isInternetExplorer()) { - it("can get the fullscreen change event name", function () { - if (Fullscreen.supportsFullscreen()) { - // the property on the document is the event name, prefixed with 'on'. - expect(document[`on${Fullscreen.changeEventName}`]).toBeDefined(); - } else { - expect(Fullscreen.changeEventName).toBeUndefined(); - } - }); - - it("can get the fullscreen error event name", function () { - if (Fullscreen.supportsFullscreen()) { - // the property on the document is the event name, prefixed with 'on'. - expect(document[`on${Fullscreen.errorEventName}`]).toBeDefined(); - } else { - expect(Fullscreen.errorEventName).toBeUndefined(); - } - }); - } + it("can get the fullscreen change event name", function () { + if (Fullscreen.supportsFullscreen()) { + // the property on the document is the event name, prefixed with 'on'. + expect(document[`on${Fullscreen.changeEventName}`]).toBeDefined(); + } else { + expect(Fullscreen.changeEventName).toBeUndefined(); + } + }); + + it("can get the fullscreen error event name", function () { + if (Fullscreen.supportsFullscreen()) { + // the property on the document is the event name, prefixed with 'on'. + expect(document[`on${Fullscreen.errorEventName}`]).toBeDefined(); + } else { + expect(Fullscreen.errorEventName).toBeUndefined(); + } + }); }); diff --git a/packages/engine/Specs/Core/VideoSynchronizerSpec.js b/packages/engine/Specs/Core/VideoSynchronizerSpec.js index 642011a73da..8db0fc87387 100644 --- a/packages/engine/Specs/Core/VideoSynchronizerSpec.js +++ b/packages/engine/Specs/Core/VideoSynchronizerSpec.js @@ -10,11 +10,6 @@ import { import pollToPromise from "../../../../Specs/pollToPromise.js"; describe("Core/VideoSynchronizer", function () { - //Video textures do not work on Internet Explorer - if (FeatureDetection.isInternetExplorer()) { - return; - } - function loadVideo() { const element = document.createElement("video"); let source = document.createElement("source"); diff --git a/packages/engine/Specs/Scene/Model/ModelSpec.js b/packages/engine/Specs/Scene/Model/ModelSpec.js index 9d05e9c7d4e..c5fb89f972a 100644 --- a/packages/engine/Specs/Scene/Model/ModelSpec.js +++ b/packages/engine/Specs/Scene/Model/ModelSpec.js @@ -1845,10 +1845,6 @@ describe( }); it("picks box textured", async function () { - if (FeatureDetection.isInternetExplorer()) { - // Workaround IE 11.0.9. This test fails when all tests are ran without a breakpoint here. - return; - } // This model gets clipped if log depth is disabled, so zoom out // the camera just a little @@ -1868,10 +1864,6 @@ describe( }); it("picks box textured with id", async function () { - if (FeatureDetection.isInternetExplorer()) { - // Workaround IE 11.0.9. This test fails when all tests are ran without a breakpoint here. - return; - } // This model gets clipped if log depth is disabled, so zoom out // the camera just a little @@ -1893,10 +1885,6 @@ describe( }); it("picks box textured with a new id", async function () { - if (FeatureDetection.isInternetExplorer()) { - // Workaround IE 11.0.9. This test fails when all tests are ran without a breakpoint here. - return; - } // This model gets clipped if log depth is disabled, so zoom out // the camera just a little @@ -1925,10 +1913,6 @@ describe( }); it("doesn't pick when allowPicking is false", async function () { - if (FeatureDetection.isInternetExplorer()) { - // Workaround IE 11.0.9. This test fails when all tests are ran without a breakpoint here. - return; - } // This model gets clipped if log depth is disabled, so zoom out // the camera just a little @@ -1948,10 +1932,6 @@ describe( }); it("doesn't pick when model is hidden", async function () { - if (FeatureDetection.isInternetExplorer()) { - // Workaround IE 11.0.9. This test fails when all tests are ran without a breakpoint here. - return; - } // This model gets clipped if log depth is disabled, so zoom out // the camera just a little