lospec / pixel-editor

An online canvas based Pixel Art creation tool for Lospec.com
https://Lospec.com/pixel-editor
GNU General Public License v3.0
923 stars 74 forks source link

Added file option to import image to current layer #102

Closed NSSure closed 1 year ago

NSSure commented 1 year ago

Basic implementation is here. there is functionality that can be expanded if necessary. Nothing was done for determining where in the layer the image is imported or modifying the palette based on image colors.

netlify[bot] commented 1 year ago

Deploy Preview for competent-tesla-4b5f1e ready!

Name Link
Latest commit 854a937da5bf4118045a485af9dac9349311ac27
Latest deploy log https://app.netlify.com/sites/competent-tesla-4b5f1e/deploys/6353bf9ed2e7c4000a5bcf80
Deploy Preview https://deploy-preview-102--competent-tesla-4b5f1e.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

unsettledgames commented 1 year ago

Thanks a lot for the contribution, the basic behaviour seems to be working correctly! At the moment it would be nice to place the image at the center of the canvas instead of using its top left corner as a pivot. In the future we could generalize and recycle the code for canvas resizing to specify a custom pivot point.

It would be nice to add a checkbox to add the image colors to the palette if you feel like adding that (similar to what you've done to resize the canvas when importing). Otherwise I can probably find some time to do that.

Just a little bug, if you try to import multiple images (one after another), the dialog box is opened twice, probably related to #101

NSSure commented 1 year ago

@unsettledgames I have some time so I can take care of those three issues. One point of clarification on the bug you mention, Is that referring to the "Import image" window or the error popup when attempting to import before selecting an image? I can re-create the error popup multiple times but not the actual "Import image" window.

unsettledgames commented 1 year ago

@unsettledgames I have some time so I can take care of those three issues. One point of clarification on the bug you mention, Is that referring to the "Import image" window or the error popup when attempting to import before selecting an image? I can re-create the error popup multiple times but not the actual "Import image" window.

@NSSure thanks a lot! Regarding the bug, here are the steps to reproduce it and the effects:

So, the "Import Image" isn't duplicated, but the file explorer is opened twice. If an error occurs during the file selection, the error popup also appears twice.

NSSure commented 1 year ago

@unsettledgames Those three issues have been resolved. A workaround was added for the multiple file explorer instances using a flag to track if the window is initialized. That issue is related #101 and should probably be handled in a more structured manner in the future.

unsettledgames commented 1 year ago

@NSSure lovely work, thanks a lot for the contribution! I'm merging it, hopefully I'll find some time to fix #101 .