little changes
parent
df9a03515e
commit
515ca18fcc
|
@ -262,7 +262,7 @@ class MyGame extends Phaser.Scene {
|
||||||
// Calculate responsive font size based on screen width
|
// Calculate responsive font size based on screen width
|
||||||
const responsiveFontSize = (window.innerWidth / 950) * baseFontSize; // Adjust 800 to your desired reference width
|
const responsiveFontSize = (window.innerWidth / 950) * baseFontSize; // Adjust 800 to your desired reference width
|
||||||
const descrptText = this.add.text(screenCenterX, 70, data.description, {
|
const descrptText = this.add.text(screenCenterX, 70, data.description, {
|
||||||
font: `${responsiveFontSize}px quicksand`,
|
font: `600 ${responsiveFontSize}px Quicksand`,
|
||||||
fill: '#7c4c23',
|
fill: '#7c4c23',
|
||||||
}).setOrigin(0.5);
|
}).setOrigin(0.5);
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ import Layout from '../../layouts/Layout.astro';
|
||||||
let customCursor;
|
let customCursor;
|
||||||
const cursorSizeMultiplier = 1;
|
const cursorSizeMultiplier = 1;
|
||||||
let isErasing = false;
|
let isErasing = false;
|
||||||
|
let snapNotice;
|
||||||
|
|
||||||
function preload() {
|
function preload() {
|
||||||
this.load.image('outline', assetsList.image);
|
this.load.image('outline', assetsList.image);
|
||||||
|
@ -356,8 +357,11 @@ import Layout from '../../layouts/Layout.astro';
|
||||||
snapshotButton.on('pointerdown', () => {
|
snapshotButton.on('pointerdown', () => {
|
||||||
captureSnapshot(this);
|
captureSnapshot(this);
|
||||||
});
|
});
|
||||||
|
snapNotice = this.add.text(customWidth / 2, customHeight / 2, 'Succecfully Downloded', {font :'700 30px Quicksand', fill: '#05b3a4'});
|
||||||
|
snapNotice.setVisible(false);
|
||||||
}
|
}
|
||||||
function captureSnapshot(drawingZone) {
|
function captureSnapshot(drawingZone) {
|
||||||
|
snapNotice.setVisible(true);
|
||||||
snapshotButton.setVisible(false);
|
snapshotButton.setVisible(false);
|
||||||
customCursor.setVisible(false);
|
customCursor.setVisible(false);
|
||||||
drawingZone.renderer.snapshot((image) => {
|
drawingZone.renderer.snapshot((image) => {
|
||||||
|
@ -367,14 +371,13 @@ import Layout from '../../layouts/Layout.astro';
|
||||||
image.style.height = '120px';
|
image.style.height = '120px';
|
||||||
image.style.paddingLeft = '2px';
|
image.style.paddingLeft = '2px';
|
||||||
document.body.appendChild(image);
|
document.body.appendChild(image);
|
||||||
|
|
||||||
// Download the snapshot as an image
|
// Download the snapshot as an image
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = image.src;
|
link.href = image.src;
|
||||||
link.download = 'my_drawing.png';
|
link.download = 'my_drawing.png';
|
||||||
link.click();
|
link.click();
|
||||||
document.body.removeChild(image);
|
document.body.removeChild(image);
|
||||||
|
|
||||||
// Clear the drawing
|
// Clear the drawing
|
||||||
// graphics.clear();
|
// graphics.clear();
|
||||||
});
|
});
|
||||||
|
|
|
@ -284,10 +284,6 @@ import Layout from "../../layouts/Layout.astro";
|
||||||
firstLayer.setAlpha(0.5);
|
firstLayer.setAlpha(0.5);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Repeat the above code for secondLayer and thirdLayer
|
|
||||||
|
|
||||||
// Add this code for secondLayer
|
|
||||||
secondLayer.on('dragstart', (pointer) => {
|
secondLayer.on('dragstart', (pointer) => {
|
||||||
secondDragStartPoint.x = pointer.x;
|
secondDragStartPoint.x = pointer.x;
|
||||||
secondDragStartPoint.y = pointer.y;
|
secondDragStartPoint.y = pointer.y;
|
||||||
|
|
Loading…
Reference in New Issue