Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 28 additions & 88 deletions Specs/DomEventSimulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that this isn't actually modified it can probably become a const assignment. Maybe even a direct return

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;
}

Expand Down
32 changes: 0 additions & 32 deletions packages/engine/Source/Core/FeatureDetection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -303,8 +273,6 @@ const FeatureDetection = {
safariVersion: safariVersion,
isWebkit: isWebkit,
webkitVersion: webkitVersion,
isInternetExplorer: isInternetExplorer,
internetExplorerVersion: internetExplorerVersion,
isEdge: isEdge,
edgeVersion: edgeVersion,
isFirefox: isFirefox,
Expand Down
59 changes: 54 additions & 5 deletions packages/engine/Source/Core/GeometryFactory.js
Original file line number Diff line number Diff line change
@@ -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}.
* <p>
* Implementations of this interface are the core geometry "description" classes
* such as {@link BoxGeometry}, {@link RectangleGeometry},
* {@link EllipsoidGeometry}, and other classes with a static
* <code>createGeometry</code> 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.
* </p>
* <p>
* This type describes an interface and is not intended to be instantiated
* directly.
* </p>
*
* @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.
* <p>
* 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.
* </p>
*
* @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) {
Expand Down
6 changes: 6 additions & 0 deletions packages/engine/Source/Core/GeometryInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions packages/engine/Source/Core/ScreenSpaceEventHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions packages/engine/Source/Scene/PolylineCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions packages/engine/Source/Scene/PolylineColorAppearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions packages/engine/Source/Scene/PolylineMaterialAppearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion packages/engine/Source/Scene/ShadowMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ function createShaders(primitive, context) {
const vs = new ShaderSource({
defines: [
"VECTOR_TILE",
!FeatureDetection.isInternetExplorer() ? "CLIP_POLYLINE" : "",
"CLIP_POLYLINE",
],
sources: [PolylineCommon, vsSource],
});
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/Source/Scene/Vector3DTilePolylines.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ function createShaders(primitive, context) {
const vs = new ShaderSource({
defines: [
"VECTOR_TILE",
!FeatureDetection.isInternetExplorer() ? "CLIP_POLYLINE" : "",
"CLIP_POLYLINE",
],
sources: [PolylineCommon, vsSource],
});
Expand Down
15 changes: 1 addition & 14 deletions packages/engine/Specs/Core/FeatureDetectionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
36 changes: 17 additions & 19 deletions packages/engine/Specs/Core/FullscreenSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
});
Loading