Skip to content

Commit

Permalink
Merge pull request #251 from SamiraAtMicrosoft/samiraatmicrosoft/fix-…
Browse files Browse the repository at this point in the history
…samsung-controller-ui

Fix a-painter issue #250 where tooltip labels appear off on Samsung controllers
  • Loading branch information
fernandojsg authored Aug 24, 2018
2 parents 28d0c9b + 4fb750d commit d30b439
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
36 changes: 36 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,24 @@
position="0.058 -0.01 0.055">
</a-entity>
</a-entity>
<a-entity class="windows-motion-samsung-tooltips" visible="false">
<a-entity tooltip="text: Trigger to paint!; width: 0.1; height: 0.04; targetPosition: 0 -.3 -.1; lineHorizontalAlign: center; lineVerticalAlign: bottom; src: assets/images/tooltip.png"
position="0 -.1 -.2"
rotation="-90 0 0">
</a-entity>
<a-entity tooltip="text: Main menu; width: 0.07; height: 0.03; targetPosition: 0.005 -0.002 -.06; lineHorizontalAlign: right; src: assets/images/tooltip.png"
position="-0.1 0.02 -.05"
rotation="-90 0 0">
</a-entity>
<a-entity tooltip="text: Brush size\n(up/down); width: 0.11; height: 0.04; targetPosition: 0 -.09 -.1; lineHorizontalAlign: left; src: assets/images/tooltip.png"
position="0.2 0 -.11"
rotation="-90 0 0">
</a-entity>
<a-entity tooltip="text: Press to undo; width: 0.11; height: 0.03; targetPosition: 0 0 0; lineHorizontalAlign: left; src: assets/images/tooltip.png"
position="0.11 0 0"
rotation="-90 0 0">
</a-entity>
</a-entity>
<a-entity class="windows-motion-tooltips" visible="false">
<a-entity tooltip="text: Trigger to paint!; width: 0.1; height: 0.04; targetPosition: 0 -.3 -.1; lineHorizontalAlign: center; lineVerticalAlign: bottom; src: assets/images/tooltip.png"
position="0 -.1 -.2"
Expand Down Expand Up @@ -157,6 +175,24 @@
position="-0.058 -0.01 0.055">
</a-entity>
</a-entity>
<a-entity class="windows-motion-samsung-tooltips" visible="false">
<a-entity tooltip="text: Trigger to paint!; width: 0.1; height: 0.04; targetPosition: 0 -.3 -.1; lineHorizontalAlign: center; lineVerticalAlign: bottom; src: assets/images/tooltip.png"
position="0 -.1 -.2"
rotation="-90 0 0">
</a-entity>
<a-entity tooltip="text: Main menu; width: 0.07; height: 0.03; targetPosition: -.01 -0.004 -.06; lineHorizontalAlign: left; src: assets/images/tooltip.png"
position="0.1 0.02 -.05"
rotation="-90 0 0">
</a-entity>
<a-entity tooltip="text: Brush size\n(up/down); width: 0.11; height: 0.04; targetPosition: 0 -.09 -.1; lineHorizontalAlign: right; src: assets/images/tooltip.png"
position="-0.19 -0.003 -.11"
rotation="-90 0 0">
</a-entity>
<a-entity tooltip="text: Press to undo; width: 0.11; height: 0.03; targetPosition: 0 0 0; lineHorizontalAlign: right; src: assets/images/tooltip.png"
position="-0.11 0 0"
rotation="-90 0 0">
</a-entity>
</a-entity>
<a-entity class="windows-motion-tooltips" visible="false">
<a-entity tooltip="text: Trigger to paint!; width: 0.1; height: 0.04; targetPosition: 0 -.3 -.1; lineHorizontalAlign: center; lineVerticalAlign: bottom; src: assets/images/tooltip.png"
position="0 -.1 -.2"
Expand Down
15 changes: 14 additions & 1 deletion src/components/paint-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,21 @@ AFRAME.registerComponent('paint-controls', {

el.addEventListener('controllerconnected', function (evt) {
var controllerName = evt.detail.name;
if (controllerName === 'windows-motion-controls')
{
var gltfName = evt.detail.component.el.components['gltf-model'].data;
const SAMSUNG_DEVICE = '045E-065D';
if (!!gltfName)
{
if (gltfName.indexOf(SAMSUNG_DEVICE) >= 0)
{
controllerName = "windows-motion-samsung-controls";
}
}
}

tooltips = Utils.getTooltips(controllerName);
if (controllerName === 'windows-motion-controls') {
if (controllerName.indexOf('windows-motion') >= 0) {
// el.setAttribute('teleport-controls', {button: 'trackpad'});
} else if (controllerName === 'oculus-touch-controls') {
var hand = evt.detail.component.data.hand;
Expand Down
4 changes: 4 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ window.Utils = (function() {
var tooltips;
var tooltipName;
switch (controllerName) {
case 'windows-motion-samsung-controls': {
tooltipName = '.windows-motion-samsung-tooltips';
break;
}
case 'windows-motion-controls': {
tooltipName = '.windows-motion-tooltips';
break;
Expand Down

0 comments on commit d30b439

Please sign in to comment.