Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate MIDDLE_DOUBLE_CLICK and RIGHT_DOUBLE_CLICK events #4910

Merged
merged 3 commits into from
Jan 24, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions Apps/Sandcastle/gallery/development/Shadows.html
Original file line number Diff line number Diff line change
Expand Up @@ -703,25 +703,25 @@

var handler = new Cesium.ScreenSpaceEventHandler(canvas);

// Double click object to turn castShadows on/off
// Click object to turn castShadows on/off
handler.setInputAction(function(movement) {
var picked = scene.pick(movement.position);
if (Cesium.defined(picked) && Cesium.defined(picked.primitive)) {
var castShadows = Cesium.ShadowMode.castShadows(picked.primitive.shadows);
var receiveShadows = Cesium.ShadowMode.receiveShadows(picked.primitive.shadows);
picked.primitive.shadows = Cesium.ShadowMode.fromCastReceive(!castShadows, receiveShadows);
}
}, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

// Double middle click object to turn receiveShadows on/off
// Middle click object to turn receiveShadows on/off
handler.setInputAction(function(movement) {
var picked = scene.pick(movement.position);
if (Cesium.defined(picked)) {
var castShadows = Cesium.ShadowMode.castShadows(picked.primitive.shadows);
var receiveShadows = Cesium.ShadowMode.receiveShadows(picked.primitive.shadows);
picked.primitive.shadows = Cesium.ShadowMode.fromCastReceive(castShadows, !receiveShadows);
}
}, Cesium.ScreenSpaceEventType.MIDDLE_DOUBLE_CLICK);
}, Cesium.ScreenSpaceEventType.MIDDLE_CLICK);

//Sandcastle_End
Sandcastle.finishedLoading();
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Change Log
* Deprecated
* The properties `url` and `key` will be removed from `GeocoderViewModel` in 1.31. These properties will be available on geocoder services that support them, like `BingMapsGeocoderService`.
* The function `createBinormalAndBitangent` of `GeometryPipeline` will be removed in 1.31. Use the function `createTangentAndBitangent` instead. [#4856](https://github.com/AnalyticalGraphicsInc/cesium/pull/4856)
* The enums `LEFT_DOUBLE_CLICK`, `MIDDLE_DOUBLE_CLICK`, and `RIGHT_MIDDLE_CLICK` from `ScreenSpaceEventType` have been deprecated and will be removed in 1.31. [#2631](https://github.com/AnalyticalGraphicsInc/cesium/issues/2631)
* Breaking changes
* Removed separate `heading`, `pitch`, `roll` parameters from `Transform.headingPitchRollToFixedFrame` and `Transform.headingPitchRollQuaternion`. Pass a `headingPitchRoll` object instead. [#4843](https://github.com/AnalyticalGraphicsInc/cesium/pull/4843)
* The property `binornmal` has been renamed to `bitangent` for `Geometry` and `VertexFormat`. [#4856](https://github.com/AnalyticalGraphicsInc/cesium/pull/4856)
Expand Down
18 changes: 17 additions & 1 deletion Source/Core/ScreenSpaceEventHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ define([
'./Cartesian2',
'./defaultValue',
'./defined',
'./deprecationWarning',
'./destroyObject',
'./DeveloperError',
'./FeatureDetection',
Expand All @@ -15,6 +16,7 @@ define([
Cartesian2,
defaultValue,
defined,
deprecationWarning,
destroyObject,
DeveloperError,
FeatureDetection,
Expand Down Expand Up @@ -483,7 +485,7 @@ define([

action(touch2StartEvent);

// Touch-enabled devices, in particular iOS can have many default behaviours for
// Touch-enabled devices, in particular iOS can have many default behaviours for
// "pinch" events, which can still be executed unless we prevent them here.
event.preventDefault();
}
Expand Down Expand Up @@ -684,6 +686,14 @@ define([
registerListeners(this);
}

function checkForDoubleClick(type) {
if (type === ScreenSpaceEventType.LEFT_DOUBLE_CLICK ||
type === ScreenSpaceEventType.MIDDLE_DOUBLE_CLICK ||
type === ScreenSpaceEventType.RIGHT_DOUBLE_CLICK) {
deprecationWarning('Double Click', 'ScreenSpaceEventType.LEFT_DOUBLE_CLICK, ScreenSpaceEventType.MIDDLE_CLICK, and ScreenSpaceEventType.RIGHT_CLICK were deprecated in Cesium 1.30. They will be removed in 1.31.');
}
}

/**
* Set a function to be executed on an input event.
*
Expand All @@ -705,6 +715,8 @@ define([
}
//>>includeEnd('debug');

checkForDoubleClick(type);

var key = getInputEventKey(type, modifier);
this._inputEvents[key] = action;
};
Expand All @@ -726,6 +738,8 @@ define([
}
//>>includeEnd('debug');

checkForDoubleClick(type);

var key = getInputEventKey(type, modifier);
return this._inputEvents[key];
};
Expand All @@ -747,6 +761,8 @@ define([
}
//>>includeEnd('debug');

checkForDoubleClick(type);

var key = getInputEventKey(type, modifier);
delete this._inputEvents[key];
};
Expand Down
8 changes: 7 additions & 1 deletion Source/Core/ScreenSpaceEventType.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ define([
'use strict';

/**
* This enumerated type is for classifying mouse events: down, up, click, double click, move and move while a button is held down.
* This enumerated type is for classifying mouse events: down, up, click, move and move while a button is held down.
*
* @exports ScreenSpaceEventType
*/
Expand Down Expand Up @@ -40,6 +40,8 @@ define([
*
* @type {Number}
* @constant
*
* @deprecated
*/
LEFT_DOUBLE_CLICK : 3,

Expand Down Expand Up @@ -72,6 +74,8 @@ define([
*
* @type {Number}
* @constant
*
* @deprecated
*/
RIGHT_DOUBLE_CLICK : 8,

Expand Down Expand Up @@ -104,6 +108,8 @@ define([
*
* @type {Number}
* @constant
*
* @deprecated
*/
MIDDLE_DOUBLE_CLICK : 13,

Expand Down
4 changes: 2 additions & 2 deletions Source/Widgets/Viewer/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to
}

cesiumWidget.screenSpaceEventHandler.setInputAction(pickAndSelectObject, ScreenSpaceEventType.LEFT_CLICK);
cesiumWidget.screenSpaceEventHandler.setInputAction(pickAndTrackObject, ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
cesiumWidget.screenSpaceEventHandler.setInputAction(pickAndTrackObject, ScreenSpaceEventType.MIDDLE_CLICK);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figure this will be the biggest breaking change. If this is commonly used it may be ok to keep LEFT_DOUBLE_CLICK.

Copy link
Contributor

Choose a reason for hiding this comment

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

Keeping LEFT_DOUBLE_CLICK is fine for desktop. For UX purposes, remember neither it nor single-middle-click is available on touch devices. Double-middle-click and double-right-click should both be completely deprecated, as browser support is weak and even desktop users don't think to try them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sound good, I'll make the corrections tomorrow.

}

defineProperties(Viewer.prototype, {
Expand Down Expand Up @@ -1370,7 +1370,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to
var i;

this.screenSpaceEventHandler.removeInputAction(ScreenSpaceEventType.LEFT_CLICK);
this.screenSpaceEventHandler.removeInputAction(ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
this.screenSpaceEventHandler.removeInputAction(ScreenSpaceEventType.MIDDLE_CLICK);

// Unsubscribe from data sources
var dataSources = this.dataSources;
Expand Down