mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Merge pull request #17 from liamortiz/master
Fixed issue #9 when creating a new drawing
This commit is contained in:
commit
8773450b4e
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
function createColorPalette(selectedPalette, fillBackground, deletePreviousPalette = true) {
|
function createColorPalette(paletteColors, fillBackground, deletePreviousPalette = true) {
|
||||||
//remove current palette
|
//remove current palette
|
||||||
if (deletePreviousPalette) {
|
if (deletePreviousPalette) {
|
||||||
colors = document.getElementsByClassName('color-button');
|
colors = document.getElementsByClassName('color-button');
|
||||||
@ -11,8 +11,8 @@ function createColorPalette(selectedPalette, fillBackground, deletePreviousPalet
|
|||||||
var lightestColor = '#000000';
|
var lightestColor = '#000000';
|
||||||
var darkestColor = '#ffffff';
|
var darkestColor = '#ffffff';
|
||||||
|
|
||||||
for (var i = 0; i < selectedPalette.length; i++) {
|
for (var i = 0; i < paletteColors.length; i++) {
|
||||||
var newColor = selectedPalette[i];
|
var newColor = paletteColors[i];
|
||||||
var newColorElement = addColor(newColor);
|
var newColorElement = addColor(newColor);
|
||||||
|
|
||||||
var newColorHex = hexToRgb(newColor);
|
var newColorHex = hexToRgb(newColor);
|
||||||
|
@ -8,7 +8,7 @@ var presets = {
|
|||||||
'PICO-8': {
|
'PICO-8': {
|
||||||
width: 128,
|
width: 128,
|
||||||
height: 128,
|
height: 128,
|
||||||
palette: 'PICO-8',
|
palette: 'PICO-8'
|
||||||
},
|
},
|
||||||
'Commodore 64': {
|
'Commodore 64': {
|
||||||
width: 40,
|
width: 40,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
function setCanvasOffset (canvas, offsetLeft, offsetTop) {
|
function setCanvasOffset (canvas, offsetLeft, offsetTop) {
|
||||||
//horizontal offset
|
//horizontal offset
|
||||||
var minXOffset = -canvasSize[0]*zoom+ 164;
|
var minXOffset = -canvasSize[0]*zoom+ 164;
|
||||||
var maxXOffset = window.innerWidth - 148;
|
var maxXOffset = window.innerWidth - 300;
|
||||||
|
|
||||||
if (offsetLeft < minXOffset)
|
if (offsetLeft < minXOffset)
|
||||||
canvas.style.left = minXOffset +'px';
|
canvas.style.left = minXOffset +'px';
|
||||||
|
@ -339,6 +339,12 @@
|
|||||||
{{#specifiedPalette}}
|
{{#specifiedPalette}}
|
||||||
var keepUrl = true;
|
var keepUrl = true;
|
||||||
{{/specifiedPalette}}
|
{{/specifiedPalette}}
|
||||||
|
|
||||||
|
// Set the default palettes
|
||||||
|
palettes["Commodore 64"] = {"name":"Commodore 64","author":"","colors":["000000","626262","898989","adadad","ffffff","9f4e44","cb7e75","6d5412","a1683c","c9d487","9ae29b","5cab5e","6abfc6","887ecb","50459b","a057a3"]}
|
||||||
|
palettes["PICO-8"] = {"name":"PICO-8","author":"","colors":["000000","1D2B53","7E2553","008751","AB5236","5F574F","C2C3C7","FFF1E8","FF004D","FFA300","FFEC27","00E436","29ADFF","83769C","FF77A8","FFCCAA"]}
|
||||||
|
palettes["Gameboy Color"] = {"name":"Nintendo Gameboy (Black Zero)","author":"","colors":["2e463d","385d49","577b46","7e8416"]}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script src="/pixel-editor/pixel-editor.js"></script>
|
<script src="/pixel-editor/pixel-editor.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user