From eecf885017fd2eba88fb24447729ce8d9b06f3f6 Mon Sep 17 00:00:00 2001
From: johnshaughnessy <johnfshaughnessy@gmail.com>
Date: Mon, 24 Sep 2018 10:52:14 -0700
Subject: [PATCH] Disable user selection on some 2D elements.

---
 src/assets/stylesheets/2d-hud.scss               |  7 -------
 src/assets/stylesheets/create-object-dialog.scss |  3 +++
 src/assets/stylesheets/hub.scss                  |  3 ++-
 src/assets/stylesheets/shared.scss               |  7 +++++++
 src/assets/stylesheets/ui-root.scss              | 11 +++++------
 src/components/stats-plus.css                    |  6 ++++++
 6 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/src/assets/stylesheets/2d-hud.scss b/src/assets/stylesheets/2d-hud.scss
index b1cf61cf1..acf3d03bd 100644
--- a/src/assets/stylesheets/2d-hud.scss
+++ b/src/assets/stylesheets/2d-hud.scss
@@ -1,12 +1,5 @@
 @import 'shared';
 
-:local(.unselectable) {
-  -moz-user-select: none;
-  -webkit-user-select: none;
-  -ms-user-select: none;
-  user-select: none;
-}
-
 :local(.container) {
   position: absolute;
   display: flex;
diff --git a/src/assets/stylesheets/create-object-dialog.scss b/src/assets/stylesheets/create-object-dialog.scss
index 9500fa41e..4f612a082 100644
--- a/src/assets/stylesheets/create-object-dialog.scss
+++ b/src/assets/stylesheets/create-object-dialog.scss
@@ -9,6 +9,7 @@
 }
 
 :local(.action-button) {
+  @extend %unselectable;
   @extend %bottom-action-button;
   margin-left: 6px;
   margin-right: 6px;
@@ -20,12 +21,14 @@
 }
 
 :local(.buttons) {
+  @extend %unselectable;
   display: flex;
   flex-direction: row;
   align-items: center;
 }
 
 :local(.small-button) {
+  @extend %unselectable;
   margin-left: 0.25em;
   font-size: 2em;
   align-self: center;
diff --git a/src/assets/stylesheets/hub.scss b/src/assets/stylesheets/hub.scss
index c7ea6d87c..e24bf7f06 100644
--- a/src/assets/stylesheets/hub.scss
+++ b/src/assets/stylesheets/hub.scss
@@ -7,6 +7,7 @@
 @import 'entry';
 @import 'audio';
 @import 'info-dialog';
+@import 'shared';
 
 .a-enter-vr, .a-orientation-modal {
   display: none;
@@ -18,5 +19,5 @@
 
 
 .webxr-realities, .webxr-sessions {
-  user-select: none;
+  @extend %unselectable
 }
diff --git a/src/assets/stylesheets/shared.scss b/src/assets/stylesheets/shared.scss
index 1e52392c3..1a494fc65 100644
--- a/src/assets/stylesheets/shared.scss
+++ b/src/assets/stylesheets/shared.scss
@@ -9,6 +9,13 @@ $dark-grey: rgba(128, 128, 128, 1.0);
 $darker-grey: rgba(64, 64, 64, 1.0);
 $darkest-grey: rgba(32, 32, 32, 1.0);
 
+%unselectable {
+  -moz-user-select: none;
+  -webkit-user-select: none;
+  -ms-user-select: none;
+  user-select: none;
+}
+
 %default-font {
   font-family: 'Zilla Slab', sans-serif;
 }
diff --git a/src/assets/stylesheets/ui-root.scss b/src/assets/stylesheets/ui-root.scss
index 90f6e245e..93771621f 100644
--- a/src/assets/stylesheets/ui-root.scss
+++ b/src/assets/stylesheets/ui-root.scss
@@ -42,7 +42,7 @@
   grid-template-rows: 1fr 20px minmax(200px, 600px) 20px 1fr;
   width: 100%;
   height: 100%;
-  user-select: none;
+  @extend %unselectable;
 
   &--darkened {
     background-color: $dark-transparent;
@@ -70,13 +70,11 @@
 
 .ui-interactive {
   pointer-events: auto;
-  -moz-user-select: none;
-  -webkit-user-select: none;
-  -ms-user-select: none;
-  user-select: none;
+  @extend %unselectable;
 }
 
 :local(.nag-button) {
+  @extend %unselectable;
   position: absolute;
   top: 110px;
   left: 0;
@@ -86,7 +84,7 @@
   justify-content: center;
   height: 80px;
   pointer-events: none;
-  
+
   button {
     @extend %action-button;
     pointer-events: auto;
@@ -134,6 +132,7 @@
 }
 
 :local(.presence-info) {
+  @extend %unselectable;
   text-align: right;
   position: absolute;
   top: 0;
diff --git a/src/components/stats-plus.css b/src/components/stats-plus.css
index f3850c47b..3af930168 100644
--- a/src/components/stats-plus.css
+++ b/src/components/stats-plus.css
@@ -19,6 +19,9 @@
   padding: 8px 12px;
   color: #aaa;
   font-size: 10px;
+  -moz-user-select: none;
+  -webkit-user-select: none;
+  -ms-user-select: none;
   user-select: none;
 }
 
@@ -26,5 +29,8 @@
   right: 10px;
   left: auto;
   top: 10px;
+  -moz-user-select: none;
+  -webkit-user-select: none;
+  -ms-user-select: none;
   user-select: none;
 }
-- 
GitLab