change drawing v2, drag v2, drag v3

This commit is contained in:
dev sp
2024-01-23 13:24:00 +00:00
parent a3ad792a96
commit a65cee3ba9
7 changed files with 1447 additions and 224 deletions

View File

@@ -69,8 +69,6 @@ import Layout from '../../layouts/Layout.astro';
}
return result;
}
// shortUniqueID = generateShortUniqueID(10); // Change 10 to the desired length
// console.log(shortUniqueID);
const params = new URLSearchParams(window.location.search);
const paramsID = params.get('id');
@@ -406,26 +404,11 @@ import Layout from '../../layouts/Layout.astro';
});
customCursor = this.add.graphics();
customCursor.setDepth(2)
// Disable the default cursor
this.input.setDefaultCursor('none');
const borderThickness = 0;
const borderColor = 0xffffff; // White color (you can customize this)
const borderGraphics = this.add.graphics();
borderGraphics.lineStyle(borderThickness, borderColor);
// borderGraphics.strokeRect(drawingZone.x, drawingZone.y, drawingZone.width, drawingZone.height);
// function continueDrawing(x, y) {
// if (
// x >= drawingZone.x &&
// x <= drawingZone.x + drawingZone.width &&
// y >= drawingZone.y &&
// y <= drawingZone.y + drawingZone.height
// ) {
// // The pointer is within the drawing zone, so continue drawing
// graphics.lineTo(x, y);
// graphics.strokePath();
// }
// };
// Add a "Save Snapshot" button
if(isMobile){
snapWidth = 50;
snapHeight = 70;
@@ -491,6 +474,7 @@ import Layout from '../../layouts/Layout.astro';
function clearDrawing() {
graphics.clear();
}
let alertTriggered = false;
function update() {
const slider = document.querySelector('input[type="range"]');
if (slider && !isDrawing) {
@@ -507,6 +491,11 @@ import Layout from '../../layouts/Layout.astro';
// Position the cursor at the current mouse pointer coordinates
customCursor.x = this.input.x;
customCursor.y = this.input.y;
// Check the condition for triggering the alert
if (!alertTriggered && game.input.x > game.scale.width / 2 + 200) {
alert('Alert triggered!');
alertTriggered = true; // Ensure the alert is triggered only once
}
}
</script>
<style>