Skip to content

Commit

Permalink
Maybe panning getting stuck fixed, couldn't repro locally
Browse files Browse the repository at this point in the history
  • Loading branch information
Zequez committed Dec 28, 2024
1 parent 3a7059c commit 05da684
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 36 deletions.
30 changes: 0 additions & 30 deletions ui/src/GameSpace/Element/Element.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -158,36 +158,6 @@
$: Element = elements[previewEl.type].Element as any;
let highlighted = false;
// function handleMouseOver(ev: MouseEvent) {
// if (!$permissions.canEditComponents) return;
// if (!draggable) {
// highlighted = false;
// return;
// }
// let target: HTMLElement = ev.target as HTMLElement;
// while (true) {
// if (target === ev.currentTarget) {
// highlighted = true;
// break;
// } else if (target.draggable) {
// console.log('DRAGGABLE');
// highlighted = false;
// break;
// } else if (target.tagName === 'BUTTON') {
// highlighted = false;
// break;
// } else if (target.tagName === 'IFRAME') {
// highlighted = false;
// break;
// } else {
// target = target.parentElement as HTMLElement;
// }
// }
// }
// function handleMouseLeave() {
// highlighted = false;
// }
</script>

<div
Expand Down
8 changes: 2 additions & 6 deletions ui/src/GameSpace/Surface.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
};
const handlePanningStart = (ev: MouseEvent) => {
if (isPanning) return;
if (shouldHandlePanning(ev.target as HTMLElement)) {
isPanning = true;
const [panInitialX, panInitialY] = [panX, panY];
Expand All @@ -148,6 +149,7 @@
}
function handleMouseUp() {
console.log('Ending panning');
isPanning = false;
window.document.removeEventListener('mousemove', handleMouseMove);
window.document.removeEventListener('mouseup', handleMouseUp);
Expand Down Expand Up @@ -338,12 +340,6 @@
zoomLevel={zoom}
/>
{/each}
<!-- {#each Object.entries(playersPositions) as [hash, player] (hash)}
<div
class="absolute -left-6 -top-6 h12 w12 bg-red-500 rounded-full"
style={`transform: scale(${player.zoom}) translate(${-player.panX}px, ${-player.panY}px);`}
></div>
{/each} -->
</div>
{#if import.meta.env.MODE === 'development'}
<div class="bg-black/50 text-white rounded-tl-md absolute right-0 bottom-0 p1">
Expand Down

0 comments on commit 05da684

Please sign in to comment.