Adding background for draw canvas
grid mod
This commit is contained in:
Vince 2013-06-04 01:05:01 +02:00
parent caa4cc8735
commit 0d0aedc93a
12 changed files with 235 additions and 35 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -5,58 +5,93 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="main.css"> <link rel="stylesheet" href="main.css">
</head> </head>
<body> <body class="grid-mode">
<div class="main-wrapper"> <div class="main-wrapper">
<div class="tools"> <div class="tools">
<div class="tool"></div> <div class="tool pen"></div>
<div class="tool"></div> <div class="tool bucket"></div>
<div class="tool selected"></div> <div class="tool magicwand selected"></div>
<div class="tool"></div> <div class="tool eyedropper"></div>
<div class="tool has-group"></div> <div class="tool pen has-group"></div>
<div class="tool has-group"></div> <div class="tool pen has-group"></div>
<div class="tool"></div> <div class="tool magicwand"></div>
<div class="tool"></div> <div class="tool pen"></div>
<div class="tool has-group"></div> <div class="tool bucket has-group"></div>
</div> </div>
<div class="canvas"> <div class="canvas">
<img class="pusher" src="img/transparent_background.png"/> <img class="pusher" src="img/transparent_background.png"/>
<div class="draw-area"></div> <div class="draw-area draw-area-5"></div>
</div> </div>
<div class="previewlist"> <div id="previewlist" class="previewlist">
<div class="preview-item"> <div class="preview-item">
<img src="img/preview-state-1.png"> <img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">1</div> <div class="tile-count preview-item-overlay">1</div>
<div class="tile-close preview-item-overlay">x</div> <div class="tile-close preview-item-overlay"></div>
</div> </div>
<div class="preview-item"> <div class="preview-item selected">
<img src="img/preview-state-1.png"> <img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">2</div> <div class="tile-count preview-item-overlay">2</div>
<div class="tile-close preview-item-overlay">x</div> <div class="tile-close preview-item-overlay"></div>
</div> </div>
<div class="preview-item"> <div class="preview-item">
<img src="img/preview-state-1.png"> <img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">3</div> <div class="tile-count preview-item-overlay">3</div>
<div class="tile-close preview-item-overlay">x</div> <div class="tile-close preview-item-overlay"></div>
</div> </div>
<div class="preview-item"> <div class="preview-item">
<img src="img/preview-state-1.png"> <img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">4</div> <div class="tile-count preview-item-overlay">4</div>
<div class="tile-close preview-item-overlay">x</div> <div class="tile-close preview-item-overlay"></div>
</div> </div>
<div class="preview-item"> <div class="preview-item">
<img src="img/preview-state-1.png"> <img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">5</div> <div class="tile-count preview-item-overlay">5</div>
<div class="tile-close preview-item-overlay">x</div> <div class="tile-close preview-item-overlay"></div>
</div> </div>
<div class="preview-item"> <div class="preview-item">
<img src="img/preview-state-1.png"> <img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">6</div> <div class="tile-count preview-item-overlay">6</div>
<div class="tile-close preview-item-overlay">x</div> <div class="tile-close preview-item-overlay"></div>
</div> </div>
<div class="preview-item"> <div class="preview-item">
<img src="img/preview-state-1.png"> <img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">7</div> <div class="tile-count preview-item-overlay">7</div>
<div class="tile-close preview-item-overlay">x</div> <div class="tile-close preview-item-overlay"></div>
</div>
<div class="preview-item">
<img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">8</div>
<div class="tile-close preview-item-overlay"></div>
</div>
<div class="preview-item">
<img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">9</div>
<div class="tile-close preview-item-overlay"></div>
</div>
<div class="preview-item">
<img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">10</div>
<div class="tile-close preview-item-overlay"></div>
</div>
<div class="preview-item">
<img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">11</div>
<div class="tile-close preview-item-overlay"></div>
</div>
<div class="preview-item">
<img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">12</div>
<div class="tile-close preview-item-overlay"></div>
</div>
<div class="preview-item">
<img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">13</div>
<div class="tile-close preview-item-overlay"></div>
</div>
<div class="preview-item">
<img src="img/preview-state-1.png">
<div class="tile-count preview-item-overlay">14</div>
<div class="tile-close preview-item-overlay"></div>
</div> </div>
</div> </div>
<div class="animpreview"> <div class="animpreview">
@ -65,6 +100,19 @@
</div> </div>
</div> </div>
</div> </div>
<div class="ux-options">
Tile view mode:
<button id="toggle-mode">grid</button>
<br/>
Draw canvas background:
<select id="change-draw-area">
<option value="1">rich-texture-1</value>
<option value="2">falloutjacket</value>
<option value="3">classic</value>
<option value="4">rich-texture-2</value>
<option value="5">sober</value>
</select>
</div>
<script src="jquery-1.8.0.js"></script> <script src="jquery-1.8.0.js"></script>
<script src="main.js"></script> <script src="main.js"></script>
</body> </body>

View File

@ -4,6 +4,18 @@ body {
font-weight: 300; font-weight: 300;
} }
::-webkit-scrollbar {
-webkit-appearance: none;
width: 11px;
height: 11px;
}
::-webkit-scrollbar-thumb {
border-radius: 8px;
border: 2px solid #444; /* should match background, can't be transparent */
background-color: #444; /*rgba(0, 0, 0, .5);*/
}
.main-wrapper { .main-wrapper {
padding: 10px; padding: 10px;
position: absolute; position: absolute;
@ -23,18 +35,24 @@ body {
float: left; float: left;
height: 46px; height: 46px;
width: 46px; width: 46px;
background: no-repeat url(img/magicwand-icon.png); background-repeat: no-repeat;
background-size: 34px 34px; /*background-size: 34px;
background-position-x: 6px; background-position: 6px;*/
background-position-y: 6px; background-size: 28px;
background-position: 9px;
background-color: rgba(200,200,200, .1); background-color: rgba(200,200,200, .1);
margin: 1px; margin: 1px;
} }
.tool.magicwand { background-image: url(img/magicwand-icon.png); }
.tool.bucket { background-image: url(img/paintbucket-icon.png); }
.tool.pen { background-image: url(img/pen-icon.png); }
.tool.eyedropper { background-image: url(img/eyedropper-icon.png);}
.tool.selected, .tool.selected,
.tool:hover { .tool:hover {
cursor: pointer; cursor: pointer;
background-color: rgba(240,200,230, .3); background-color: #6b5f68; /*rgba(240,200,230, .3);*/
} }
.tool.has-group:after { .tool.has-group:after {
@ -66,7 +84,61 @@ body {
.canvas .draw-area { .canvas .draw-area {
position: absolute; position: absolute;
top:0; right: 0; bottom: 0; left: 0; top:0; right: 0; bottom: 0; left: 0;
box-shadow: 0 0 8px 5px #444;
/*
background: repeat url(img/transparent_background.png); background: repeat url(img/transparent_background.png);
*/
/*
background-color: #eee;
background-image: linear-gradient(45deg, black 25%, transparent 25%, transparent 75%, black 75%, black),
linear-gradient(45deg, black 25%, transparent 25%, transparent 75%, black 75%, black);
background-size:60px 60px;
background-position:0 0, 30px 30px
*/
}
.canvas .draw-area-1 {
background: radial-gradient(black 15%, transparent 16%) 0 0,
radial-gradient(black 15%, transparent 16%) 8px 8px,
radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 0 1px,
radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 8px 9px;
background-color:#282828;
background-size:16px 16px;
}
.canvas .draw-area-2 {
background-color: #eee;
background-image: linear-gradient(45deg, black 25%, transparent 25%, transparent 75%, black 75%, black),
linear-gradient(45deg, black 25%, transparent 25%, transparent 75%, black 75%, black);
background-size:60px 60px;
background-position:0 0, 30px 30px
}
.canvas .draw-area-3 {
background: repeat url(img/transparent_background.png);
}
.canvas .draw-area-4 {
background:
linear-gradient(27deg, #151515 5px, transparent 5px) 0 5px,
linear-gradient(207deg, #151515 5px, transparent 5px) 10px 0px,
linear-gradient(27deg, #222 5px, transparent 5px) 0px 10px,
linear-gradient(207deg, #222 5px, transparent 5px) 10px 5px,
linear-gradient(90deg, #1b1b1b 10px, transparent 10px),
linear-gradient(#1d1d1d 25%, #1a1a1a 25%, #1a1a1a 50%, transparent 50%, transparent 75%, #242424 75%, #242424);
background-color: #131313;
background-size: 20px 20px;
}
.canvas .draw-area-5 {
border: #6b5f68 1px solid;
background-color:#444;
background-image: linear-gradient(#6b5f68 1px, transparent 1px),
linear-gradient(90deg, #6b5f68 1px, transparent 1px),
linear-gradient(#6b5f68 1px, transparent 1px),
linear-gradient(90deg, #6b5f68 1px, transparent 1px);
background-size:100px 100px, 100px 100px, 20px 20px, 20px 20px;
background-position:-1px -1px, -1px -1px, -1px -1px, -1px -1px;
} }
.canvas .pusher { .canvas .pusher {
@ -77,17 +149,24 @@ body {
.previewlist { .previewlist {
float: left; float: left;
background-color: red; background-color: #111;
width: 120px;
height: 100%; height: 100%;
overflow-y: scroll; overflow-y: scroll;
} }
.preview-item { .preview-item {
position: relative; position: relative;
border: gray 1px solid; border: #444 6px solid;
width: 200px; border-radius: 3px;
height: 200px; width: 90px;
background-color: violet; margin-bottom: 5px;
margin-right: 5px;
font-size: 0;
}
.preview-item.selected {
border-color: gold;
} }
.preview-item-overlay { .preview-item-overlay {
@ -96,16 +175,15 @@ body {
background-color: rgba(0, 0, 0, 0.3); background-color: rgba(0, 0, 0, 0.3);
font-size: 14px; font-size: 14px;
color: white; color: white;
padding: 5px 8px;
cursor: pointer;
font-weight: bold; font-weight: bold;
display: none; opacity: 0;
height: 30px;
width: 30px;
} }
.preview-item:hover .preview-item-overlay, .preview-item:hover .preview-item-overlay,
.preview-item-overlay:hover { .preview-item-overlay:hover {
display: block;
opacity: 1.0; opacity: 1.0;
} }
@ -115,18 +193,49 @@ body {
border-bottom-right-radius: 3px; border-bottom-right-radius: 3px;
top: 0; top: 0;
left: 0; left: 0;
line-height: 30px;
text-align: center;
} }
.preview-item-overlay.tile-close { .preview-item-overlay.tile-close {
border-bottom-left-radius: 3px; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
background-color: rgba(0, 0, 0, 0.3);
border-bottom-left-radius: 3px;
height: 30px;
width: 30px;
cursor: pointer;
}
.preview-item-overlay.tile-close:after {
content: " ";
position: absolute;
background: no-repeat url(img/garbage.png) 5px 5px;
background-size: 20px 20px;
top: 0; right: 0; bottom: 0; left: 0;
z-index: 10;
} }
.preview-item img { .preview-item img {
width: 100%; width: 100%;
} }
.grid-mode .previewlist {
float: none;
width: auto;
overflow: hidden;
background: none;
}
.grid-mode .preview-item {
float: left;
}
.grid-mode .animpreview {
display: none;
}
.animpreview { .animpreview {
overflow: hidden; overflow: hidden;
text-align: center; text-align: center;
@ -142,4 +251,23 @@ body {
.animpreview img { .animpreview img {
width: 50%; width: 50%;
box-shadow: 0 0 5px 5px #000; box-shadow: 0 0 5px 5px #000;
}
.ux-options:hover {
opacity: 1.0;
}
.ux-options {
color: #ddd;
font-size: 14px;
position: absolute;
padding: 5px;
bottom: 0;
right: 0;
background-color: #333;
opacity: 0.3;
border: #fff solid 3px;
border-right: none;
border-bottom: none;
} }

View File

@ -1,3 +1,27 @@
$().ready(function(){ $().ready(function(){
$(document).on('click', '.tile-close', function(evt) {
$(evt.target).closest('.preview-item').remove();
});
$(document).on('click', '.preview-item', function(evt) {
$('.preview-item').removeClass('selected');
$(evt.target).closest('.preview-item').addClass('selected');
});
$(document).on('click', '#toggle-mode', function(evt) {
$('body').toggleClass('grid-mode');
});
/*
$(document).on('click', '#change-draw-area', function(evt) {
$('body').toggleClass('grid-mode');
});*/
$("#change-draw-area").change(function () {
var str = "";
$("#change-draw-area option:selected").each(function () {
str = $(this).val();
});
$(".canvas .draw-area").attr('class', 'draw-area draw-area-'+ str);
})
}); });