Skip to content

Commit 44af125

Browse files
Merge pull request #523 from MetaCell/release/1.2.4
Merge back release changes to master
2 parents a349099 + 302f0fc commit 44af125

File tree

3 files changed

+96
-73
lines changed

3 files changed

+96
-73
lines changed

geppetto-showcase/src/App.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ export default class App extends Component {
2525
button: { main: '#fc6320' },
2626
toolbarBackground: { main: 'rgb(0,0,0,0.5)' },
2727
},
28+
overrides: {
29+
MuiListItemIcon: {
30+
root: {
31+
'& i.my-svg-icon': {
32+
backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M7.32911 13.2291L3.85411 9.75414L2.67078 10.9291L7.32911 15.5875L17.3291 5.58748L16.1541 4.41248L7.32911 13.2291Z' fill='%23D6D5D7'/%3E%3C/svg%3E");`,
33+
display: 'inline-block',
34+
width: '16px',
35+
height: '12px',
36+
backgroundSize: 'contain',
37+
backgroundRepeat: 'no-repeat'
38+
}
39+
}
40+
}
41+
}
2842
});
2943
theme = responsiveFontSizes(theme);
3044

geppetto-showcase/src/examples/menu/menuConfiguration.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
const toolbarMenu = {
24
global: {
35
buttonsStyle: {
@@ -122,7 +124,17 @@ const toolbarMenu = {
122124
},
123125
},
124126
{
125-
label: 'Feedback',
127+
label: (
128+
<>
129+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
130+
<path d="M7.32911 13.2291L3.85411 9.75414L2.67078 10.9291L7.32911 15.5875L17.3291 5.58748L16.1541 4.41248L7.32911 13.2291Z" fill="#D6D5D7"/>
131+
</svg>
132+
Feedback
133+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
134+
<path d="M7.32911 13.2291L3.85411 9.75414L2.67078 10.9291L7.32911 15.5875L17.3291 5.58748L16.1541 4.41248L7.32911 13.2291Z" fill="#5A48E6"/>
135+
</svg>
136+
</>
137+
),
126138
icon: '',
127139
action: {
128140
handlerAction: 'clickFeedback',
@@ -131,7 +143,7 @@ const toolbarMenu = {
131143
},
132144
{
133145
label: 'Social media',
134-
icon: '',
146+
icon: 'my-svg-icon',
135147
position: 'right-start',
136148
action: {
137149
handlerAction: 'submenu',

geppetto.js/geppetto-ui/src/3d-canvas/threeDEngine/ThreeDEngine.js

Lines changed: 68 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -245,85 +245,82 @@ export default class ThreeDEngine {
245245
/ this.renderer.domElement.width
246246
) * 2 - 1;
247247

248-
if (event.button === 0) {
249-
// only for left click
250-
if (this.pickingEnabled) {
251-
const intersects = this.getIntersectedObjects();
252-
253-
if (intersects.length > 0) {
254-
// sort intersects
255-
const compare = function (a, b) {
256-
if (a.distance < b.distance) {
257-
return -1;
258-
}
259-
if (a.distance > b.distance) {
260-
return 1;
261-
}
262-
return 0;
248+
if (this.pickingEnabled) {
249+
const intersects = this.getIntersectedObjects();
250+
251+
if (intersects.length > 0) {
252+
// sort intersects
253+
const compare = function (a, b) {
254+
if (a.distance < b.distance) {
255+
return -1;
263256
}
264-
intersects.sort(compare);
257+
if (a.distance > b.distance) {
258+
return 1;
259+
}
260+
return 0;
265261
}
262+
intersects.sort(compare);
263+
}
266264

267-
let selectedMap = {};
268-
// Iterate and get the first visible item (they are now ordered by proximity)
269-
for (let i = 0; i < intersects.length; i++) {
270-
// figure out if the entity is visible
271-
let instancePath = '';
272-
let externalMeshId = null;
273-
let geometryIdentifier = '';
274-
if (
275-
Object.prototype.hasOwnProperty.call(
276-
intersects[i].object,
277-
'instancePath'
278-
)
279-
) {
280-
instancePath = intersects[i].object.instancePath;
281-
geometryIdentifier
282-
= intersects[i].object.geometryIdentifier;
283-
} else if (Object.prototype.hasOwnProperty.call(
284-
intersects[i].object.parent,
285-
'instancePath'
286-
)) {
287-
instancePath = intersects[i].object.parent.instancePath;
288-
geometryIdentifier
289-
= intersects[i].object.parent.geometryIdentifier;
290-
}
291-
else {
292-
externalMeshId = intersects[i].object.uuid
293-
geometryIdentifier = null
294-
}
265+
let selectedMap = {};
266+
// Iterate and get the first visible item (they are now ordered by proximity)
267+
for (let i = 0; i < intersects.length; i++) {
268+
// figure out if the entity is visible
269+
let instancePath = '';
270+
let externalMeshId = null;
271+
let geometryIdentifier = '';
272+
if (
273+
Object.prototype.hasOwnProperty.call(
274+
intersects[i].object,
275+
'instancePath'
276+
)
277+
) {
278+
instancePath = intersects[i].object.instancePath;
279+
geometryIdentifier
280+
= intersects[i].object.geometryIdentifier;
281+
} else if (Object.prototype.hasOwnProperty.call(
282+
intersects[i].object.parent,
283+
'instancePath'
284+
)) {
285+
instancePath = intersects[i].object.parent.instancePath;
286+
geometryIdentifier
287+
= intersects[i].object.parent.geometryIdentifier;
288+
}
289+
else {
290+
externalMeshId = intersects[i].object.uuid
291+
geometryIdentifier = null
292+
}
295293

296-
if (
297-
(instancePath != null
298-
&& Object.prototype.hasOwnProperty.call(
299-
this.meshFactory.meshes,
300-
instancePath
301-
))
302-
|| Object.prototype.hasOwnProperty.call(
303-
this.meshFactory.splitMeshes,
304-
instancePath
305-
)
306-
) {
307-
if (!(instancePath in selectedMap)) {
308-
selectedMap[instancePath] = {
309-
...intersects[i],
310-
geometryIdentifier: geometryIdentifier,
311-
distanceIndex: i,
312-
};
313-
}
294+
if (
295+
(instancePath != null
296+
&& Object.prototype.hasOwnProperty.call(
297+
this.meshFactory.meshes,
298+
instancePath
299+
))
300+
|| Object.prototype.hasOwnProperty.call(
301+
this.meshFactory.splitMeshes,
302+
instancePath
303+
)
304+
) {
305+
if (!(instancePath in selectedMap)) {
306+
selectedMap[instancePath] = {
307+
...intersects[i],
308+
geometryIdentifier: geometryIdentifier,
309+
distanceIndex: i,
310+
};
314311
}
315-
if (externalMeshId != null) {
316-
if (!(externalMeshId in selectedMap)) {
317-
selectedMap[externalMeshId] = {
318-
...intersects[i],
319-
distanceIndex: i,
320-
};
321-
}
312+
}
313+
if (externalMeshId != null) {
314+
if (!(externalMeshId in selectedMap)) {
315+
selectedMap[externalMeshId] = {
316+
...intersects[i],
317+
distanceIndex: i,
318+
};
322319
}
323320
}
324-
this.requestFrame();
325-
this.onSelection(this.selectionStrategy(selectedMap))
326321
}
322+
this.requestFrame();
323+
this.onSelection(this.selectionStrategy(selectedMap), event)
327324
}
328325
}
329326
}

0 commit comments

Comments
 (0)