Skip to content

Commit 4290f00

Browse files
committed
Fix margins not being scaled
1 parent be86359 commit 4290f00

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

scripts/communityScripts/chatBubbles/chatBubbles.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ function ChatBubbles_SpawnBubble(data, senderID) {
184184
canCastShadow: false,
185185
billboardMode: "yaw",
186186
alignment: "center",
187-
verticalAlignment: "top",
188-
topMargin: 0.015,
187+
verticalAlignment: "center",
188+
topMargin: -0.004 * scale, // center isn't exactly centered?
189189
grab: {grabbable: false},
190190
renderLayer: "front",
191191
script: (link === undefined && !linkIsImage) ? undefined :
@@ -200,11 +200,10 @@ function ChatBubbles_SpawnBubble(data, senderID) {
200200
}, "local");
201201

202202
Script.setTimeout(() => {
203-
const { dimensions, text } = Entities.getEntityProperties(bubbleEntity, ["dimensions", "text"]);
204203
const size = Entities.textSize(bubbleEntity, text);
205204
Entities.editEntity(bubbleEntity, {
206205
visible: true,
207-
dimensions: [size.width + 0.06, dimensions.y, 0.01],
206+
dimensions: [size.width + (0.06 * scale), size.height + (0.04 * scale), 0.01],
208207
});
209208
}, 100);
210209
// this wait time is annoyingly inconsistent,
@@ -213,7 +212,7 @@ function ChatBubbles_SpawnBubble(data, senderID) {
213212

214213
for (const bubble of Object.values(currentBubbles[senderID])) {
215214
let { localPosition } = Entities.getEntityProperties(bubble.entity, "localPosition");
216-
localPosition = Vec3.sum(localPosition, [0, height + 0.05, 0]);
215+
localPosition = Vec3.sum(localPosition, [0, height + (0.05 * scale), 0]);
217216
Entities.editEntity(bubble.entity, { localPosition: localPosition });
218217
}
219218

0 commit comments

Comments
 (0)