Sketchy/Mobile/js/main.js

39 lines
934 B
JavaScript
Raw Normal View History

2014-02-01 18:18:29 +00:00
"use strict";
$(document).ready(function() {
2014-02-02 20:16:28 +00:00
window.c = $('canvas')[0].getContext('2d');
window.o = $('canvas')[1].getContext('2d');
2014-02-01 18:18:29 +00:00
window.settings = {
2014-02-05 13:02:07 +00:00
lineWidth : 2,
color : 'black',
2014-02-01 18:18:29 +00:00
type: 'sketch',
lineCap: 'round',
2014-02-02 20:16:28 +00:00
lineJoin: 'round',
2014-02-05 13:02:07 +00:00
furLength: 5,
2014-02-06 16:18:11 +00:00
connectTelorance: 40,
composite: 'source-over'
2014-02-01 18:18:29 +00:00
};
window.points = [];
window.$c = $('canvas');
2014-02-02 20:16:28 +00:00
window.points.history = [{ data: c.createImageData($c.width(), $c.height()), points: []}];
window.points.history.last = 0;
2014-02-01 18:18:29 +00:00
sizeAndPos();
2014-02-06 14:40:10 +00:00
//$(window).resize(sizeAndPos);
2014-02-01 18:18:29 +00:00
2014-02-05 13:02:07 +00:00
$('.color-picker').change(function() {
var c = $(this).find('.color').val();
settings.color = c;
$('#setcolor span').html(c);
})
$('.color').val('#000000');
2014-02-07 12:20:19 +00:00
/*yepnope({
2014-02-05 13:02:07 +00:00
test: window.mobile,
2014-02-07 12:20:19 +00:00
yep : ['js/libs/touch.js', 'js/mobile.js', 'js/libs/color-picker-touch.js'],
nope: ['js/desktop.js', 'js/libs/color-picker.js']
})*/
2014-02-05 13:02:07 +00:00
2014-02-01 18:18:29 +00:00
})