Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/ace/touchHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,17 @@ export default function addTouchListeners(editor, minimal, onclick) {
const range = editor.getSelectionRange();
const { pageX, pageY } = renderer.textToScreenCoordinates(range.start);
const { lineHeight } = renderer;
const [x, y] = relativePosition(pageX - teardropSize, pageY + lineHeight);

$start.style.left = `${x}px`;
// Calculate desired position but ensure it stays within viewport
let targetX = pageX - teardropSize;
const [relativeX, y] = relativePosition(targetX, pageY + lineHeight);

// Ensure the teardrop doesn't go outside the left edge
// Leave some padding (e.g., 4px) so it's not flush against the edge
const minX = 4;
const constrainedX = Math.max(relativeX, minX);

$start.style.left = `${constrainedX}px`;
$start.style.top = `${y}px`;

if (!$start.isConnected) $el.append($start);
Expand Down