Wplace-BlueMarble/src/overlay.css
Nicholas 1d78a140dd Enhance overlay drag and file input handling
Improved the overlay drag logic for smoother, GPU-accelerated movement using requestAnimationFrame and transform. Updated file input elements to use stronger hiding techniques, preventing browser-native text from appearing during minimize/maximize. Updated version to 0.72.0 and added additional debug logging and minor UI/UX improvements.
2025-08-05 14:18:12 -03:00

278 lines
No EOL
6.4 KiB
CSS

/* @since 0.5.1 */
/* The entire overlay */
#bm-overlay {
position: fixed;
background-color: rgba(21, 48, 99, 0.9);
color: white;
padding: 10px;
border-radius: 8px;
z-index: 9000;
transition: all 0.3s ease;
max-width: 300px;
width: auto;
/* Performance optimizations for smooth dragging */
will-change: transform;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
}
/* Smooth transitions for minimize/maximize functionality */
#bm-contain-userinfo,
#bm-overlay hr,
#bm-contain-automation,
#bm-contain-buttons-action {
transition: opacity 0.2s ease, height 0.2s ease;
}
/* The entire overlay BUT it is cascading */
div#bm-overlay {
/* Font stack is as follows:
* Highest Priority (Roboto Mono)
* Windows fallback (Courier New)
* macOS fallback (Monaco)
* Linux fallback (DejaVu Sans Mono)
* Any possible monospace font (monospace)
* Last resort (Arial) */
font-family: 'Roboto Mono', 'Courier New', 'Monaco', 'DejaVu Sans Mono', monospace, 'Arial';
letter-spacing: 0.05em;
}
/* The drag bar */
#bm-bar-drag {
margin-bottom: 0.5em;
/* For background circles, width & height should be odd, cx & cy should be half of width & height, and r should be less than or equal to cx & cy */
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="5" height="5"><circle cx="3" cy="3" r="1.5" fill="CornflowerBlue" /></svg>') repeat;
cursor: grab;
width: 100%;
height: 1em;
}
/* When the overlay is being dragged */
#bm-bar-drag.dragging {
cursor: grabbing;
}
/* Disable interactions during drag for better performance */
#bm-overlay:has(#bm-bar-drag.dragging) {
pointer-events: none;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
/* Keep drag bar interactive when dragging */
#bm-bar-drag.dragging {
pointer-events: auto;
}
/* The container for the overlay header */
#bm-contain-header {
margin-bottom: 0.5em;
}
/* When minimized, adjust header container */
#bm-contain-header[style*="text-align: center"] {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* Ensure overlay maintains consistent width when minimized */
#bm-overlay[style*="padding: 5px"] {
width: auto !important;
max-width: 300px;
min-width: 200px;
}
/* The Blue Marble image */
#bm-overlay img {
display: inline-block;
height: 2.5em;
margin-right: 1ch;
vertical-align: middle;
transition: opacity 0.2s ease;
}
/* When overlay is minimized, adjust image styling */
#bm-contain-header[style*="text-align: center"] img {
margin-right: 0;
margin-left: 0;
display: block;
margin: 0 auto;
}
/* Ensure drag bar remains functional when minimized */
#bm-bar-drag {
transition: margin-bottom 0.2s ease;
}
/* The Blue Marble header */
#bm-overlay h1 {
display: inline-block;
font-size: x-large;
font-weight: bold;
vertical-align: middle;
}
/* Checkboxes in the automation container */
#bm-contain-automation input[type="checkbox"] {
vertical-align: middle;
margin-right: 0.5ch;
}
/* Checkbox label/flavor text in the automation container */
#bm-contain-automation label {
margin-right: 0.5ch;
}
/* Question Mark button */
.bm-help {
border: white 1px solid;
height: 1.5em;
width: 1.5em;
margin-top: 2px;
text-align: center;
line-height: 1em;
padding: 0 !important; /* Overrides the padding in "#bm-overlay button" */
}
/* Pin button */
#bm-button-coords {
vertical-align: middle;
}
/* Pin button image*/
#bm-button-coords svg {
width: 50%;
margin: 0 auto;
fill: #111;
}
/* Container for action buttons, that is inside the action button container */
div:has(> #bm-button-teleport) {
display: flex;
gap: 0.5ch;
}
/* Favorite (Star) button image */
/* Templates (Person) button image */
#bm-button-favorite svg,
#bm-button-template svg {
height: 1em;
margin: 0 auto;
margin-top: 2px;
text-align: center;
line-height: 1em;
vertical-align: bottom;
}
/* Tile (x, y) & Pixel (x, y) input fields */
#bm-contain-coords input[type="number"] {
appearance: auto;
-moz-appearance: textfield;
width: 5.5ch;
margin-left: 1ch;
background-color: rgba(0, 0, 0, 0.2);
padding: 0 0.5ch;
font-size: small;
}
/* Removes scroll bar on tile & pixel input fields */
#bm-contain-coords input[type="number"]::-webkit-outer-spin-button,
#bm-contain-coords input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Automation button container */
#bm-contain-buttons-template {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-content: center;
justify-content: center;
align-items: center;
gap: 1ch;
}
/* The template file upload button */
div:has(> #bm-input-file-template) > button {
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Force complete invisibility of file input to prevent native browser text */
#bm-input-file-template,
input[type="file"][id*="template"] {
display: none !important;
visibility: hidden !important;
position: absolute !important;
left: -9999px !important;
top: -9999px !important;
width: 0 !important;
height: 0 !important;
opacity: 0 !important;
z-index: -9999 !important;
pointer-events: none !important;
}
/* Output status area */
#bm-output-status {
font-size: small;
background-color: rgba(0, 0, 0, 0.2);
padding: 0 0.5ch;
height: 3.75em;
width: 100%;
}
/* The action buttons below the status textarea */
#bm-contain-buttons-action {
display: flex;
justify-content: space-between;
}
/* All small elements */
#bm-overlay small {
font-size: x-small;
color: lightgray;
}
/* The elements that need spacing from each-other */
#bm-contain-userinfo,
#bm-contain-automation,
#bm-contain-coords,
#bm-contain-buttons-template,
div:has(> #bm-input-file-template),
#bm-output-status {
margin-top: 0.5em;
}
/* All overlay buttons */
#bm-overlay button {
background-color: #144eb9;
border-radius: 1em;
padding: 0 0.75ch;
}
/* All overlay buttons when hovered/focused */
#bm-overlay button:hover, #bm-overlay button:focus-visible {
background-color: #1061e5;
}
/* All overlay buttons when pressed (plus disabled color) */
#bm-overlay button:active,
#bm-overlay button:disabled {
background-color: #2e97ff;
}
/* All overlay buttons when disabled */
#bm-overlay button:disabled {
text-decoration: line-through;
}