Skip to content

Commit fff2e58

Browse files
authored
Merge pull request #138 from musehq/dev
v2.6.3
2 parents e53384d + 67b0add commit fff2e58

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "spacesvr",
3-
"version": "2.6.2",
3+
"version": "2.6.3",
44
"private": true,
55
"description": "A standardized reality for future of the 3D Web",
66
"keywords": [

src/ideas/ui/TextInput/index.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,24 +145,23 @@ export function TextInput(props: TextProps) {
145145
_text.sync();
146146
}, []);
147147

148+
const SHOW_PLACEHOLDER = !focused && placeholder && !input.value;
149+
const VAL = SHOW_PLACEHOLDER
150+
? placeholder
151+
: type === "password"
152+
? input.value.replace(/./g, "•")
153+
: input.value;
154+
const COL = SHOW_PLACEHOLDER ? "#828282" : "#000";
155+
148156
const scrollLeft = useRef(0);
149157
const blink = useCaretBlink(0.65);
150158
if (textRef.current && input && caret.current && highlight.current) {
151159
const _text = textRef.current;
152160
const _caret = caret.current;
153161
const _highlight = highlight.current;
154162

155-
if (!focused && placeholder && input.value === "") {
156-
_text.text = placeholder;
157-
_text.color = "#828282";
158-
} else {
159-
if (type === "password") {
160-
_text.text = input.value.replace(/./g, "•");
161-
} else {
162-
_text.text = input.value;
163-
}
164-
_text.color = "black";
165-
}
163+
_text.text = VAL;
164+
_text.color = COL;
166165

167166
syncOnChange(_text, "focused", focused);
168167
syncOnChange(_text, "selectionStart", input.selectionStart);
@@ -202,7 +201,8 @@ export function TextInput(props: TextProps) {
202201
const lastIndex = caretPositions.length - 2;
203202
const activeIndex = Math.min(activeSel * 3, input.value.length * 3 - 2);
204203
const lastCaretX = caretPositions[lastIndex];
205-
const activeCaretX = caretPositions[activeIndex] || lastCaretX; // fallback for fast typing
204+
const activeCaretX =
205+
activeSel == 0 ? 0 : caretPositions[activeIndex] || lastCaretX; // fallback for fast typing
206206

207207
// move it to the active character
208208
if (activeCaretX !== undefined) {
@@ -315,16 +315,17 @@ export function TextInput(props: TextProps) {
315315
<Text
316316
name="text"
317317
ref={textRef}
318-
color="black"
318+
color={COL}
319319
anchorX="left"
320320
fontSize={fontSize}
321321
font={font}
322322
maxWidth={INNER_WIDTH}
323+
position-x={-INNER_WIDTH / 2}
323324
// @ts-ignore
324325
whiteSpace="nowrap"
325326
renderOrder={2}
326327
>
327-
{""}
328+
{VAL}
328329
</Text>
329330
</Suspense>
330331
<group name="blink" ref={blink.blinkRef}>

src/layers/Environment/ui/PauseMenu/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default function PauseMenu(props: PauseMenuProps) {
4848
const PAUSE_ITEMS: PauseItem[] = [
4949
...pauseMenuItems,
5050
{
51-
text: "v2.6.2",
51+
text: "v2.6.3",
5252
link: "https://www.npmjs.com/package/spacesvr",
5353
},
5454
...menuItems,

src/tools/Camera/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ import { useLimitedFrame } from "../../logic";
2020
const AUDIO_URL =
2121
"https://d27rt3a60hh1lx.cloudfront.net/tools/camera/shutter-sound.mp3";
2222

23-
export function Camera() {
23+
type CameraProps = { onCapture?: () => void };
24+
25+
export function Camera(props: CameraProps) {
26+
const { onCapture } = props;
27+
2428
const { device, paused } = useEnvironment();
2529
const { scene } = useThree();
2630
const toolbelt = useToolbelt();
@@ -62,6 +66,7 @@ export function Camera() {
6266
const audio = new Audio(AUDIO_URL);
6367
audio.play();
6468
photo.takePicture();
69+
if (onCapture) onCapture();
6570
};
6671

6772
useEffect(() => {

src/tools/Camera/utils/photo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export const usePhotography = (
5656
r.toneMapping = ACESFilmicToneMapping;
5757

5858
document.body.append(r.domElement);
59+
cam.current.aspect = aspect.x / aspect.y;
5960

6061
r.render(scene, cam.current);
6162

0 commit comments

Comments
 (0)