incname commited on
Commit
fcae422
·
1 Parent(s): a7000ba

Update BlockEditor.tsx

Browse files
client/src/components/BlockEditor/BlockEditor.tsx CHANGED
@@ -1136,8 +1136,8 @@ export default function BlockEditor() {
1136
  const w = workspaceRef.current;
1137
  const cr = blocklyDiv.current?.getBoundingClientRect();
1138
  if (!w || !cr) return null;
1139
- const vx = cr.left + pointer.x * w.scale;
1140
- const vy = cr.top + pointer.y * w.scale;
1141
  // Hide pointer if outside the blockly canvas bounds
1142
  if (vx < cr.left || vx > cr.right || vy < cr.top || vy > cr.bottom) return null;
1143
  return (
@@ -1170,8 +1170,8 @@ export default function BlockEditor() {
1170
  if (w) {
1171
  const cr = blocklyDiv.current?.getBoundingClientRect();
1172
  if (cr) {
1173
- vx = cr.left + drag.x * w.scale;
1174
- vy = cr.top + drag.y * w.scale;
1175
  }
1176
  }
1177
  const collab = collaborators.find(c => c.userId === userId);
 
1136
  const w = workspaceRef.current;
1137
  const cr = blocklyDiv.current?.getBoundingClientRect();
1138
  if (!w || !cr) return null;
1139
+ const vx = cr.left + (pointer.x + w.scrollX) * w.scale;
1140
+ const vy = cr.top + (pointer.y + w.scrollY) * w.scale;
1141
  // Hide pointer if outside the blockly canvas bounds
1142
  if (vx < cr.left || vx > cr.right || vy < cr.top || vy > cr.bottom) return null;
1143
  return (
 
1170
  if (w) {
1171
  const cr = blocklyDiv.current?.getBoundingClientRect();
1172
  if (cr) {
1173
+ vx = cr.left + (drag.x + w.scrollX) * w.scale;
1174
+ vy = cr.top + (drag.y + w.scrollY) * w.scale;
1175
  }
1176
  }
1177
  const collab = collaborators.find(c => c.userId === userId);