Skip to content

Commit 6d4b258

Browse files
committed
Add modifiers to picker
1 parent f489e73 commit 6d4b258

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

js/scripts/three-class-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ module.exports = {
258258
faceNormal: new Types.Vector3(0, 0, 0),
259259
faceVertices: new Types.VectorArray(),
260260
faceIndex: new Types.Int(null, {nullable: true}),
261+
modifiers: new Types.Array(),
261262
object: new Types.ThreeType('Object3D', {nullable: true}),
262263
picked: new Types.Array(),
263264
uv: new Types.Vector2(0, 0),

js/src/controls/Picker.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var PickerModel = PickerAutogen.PickerModel.extend({
4444
} else {
4545
info.picked = [];
4646
}
47+
info.modifiers = this.obj.modifiers;
4748
this.set(info, 'pushFromThree');
4849
this.save_changes();
4950
},
@@ -58,6 +59,7 @@ var PickerControls = function(event) {
5859
scope.element = null;
5960

6061
this.pickCoordinates = null;
62+
this.modifiers = null;
6163

6264
this.connectEvents = function(element) {
6365
scope.element = element;
@@ -75,6 +77,16 @@ var PickerControls = function(event) {
7577
var mouseY = -((event.pageY - offset.top) / $el.height()) * 2 + 1;
7678

7779
scope.pickCoordinates = {x: mouseX, y: mouseY};
80+
if (event.altKey !== undefined) {
81+
scope.modifiers = [
82+
event.shiftKey,
83+
event.ctrlKey,
84+
event.altKey,
85+
event.metaKey,
86+
]
87+
} else {
88+
scope.modifiers = null;
89+
}
7890

7991
scope.dispatchEvent( pickEvent );
8092
}

0 commit comments

Comments
 (0)