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-16 14:30:45 +00:00
|
|
|
window.c.clear = window.o.clear = function() {
|
|
|
|
this.clearRect(0, 0, width(), height());
|
|
|
|
}
|
2014-02-01 18:18:29 +00:00
|
|
|
window.settings = {
|
2014-02-16 14:30:45 +00:00
|
|
|
stroke: true,
|
|
|
|
fill: false,
|
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,
|
2014-02-16 14:30:45 +00:00
|
|
|
composite: 'source-over',
|
|
|
|
shape: 'circle',
|
|
|
|
shapeStart: {},
|
|
|
|
comShape: {},
|
|
|
|
drawingLine: [],
|
|
|
|
version: 1.2
|
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: []}];
|
2014-02-06 20:39:42 +00:00
|
|
|
window.points.history.last = 0;
|
2014-02-01 18:18:29 +00:00
|
|
|
|
|
|
|
sizeAndPos();
|
|
|
|
|
2014-02-05 13:02:07 +00:00
|
|
|
$('.color-picker').change(function() {
|
|
|
|
var c = $(this).find('.color').val();
|
2014-02-16 14:30:45 +00:00
|
|
|
var caller = $(this).parent().attr('data-caller');
|
|
|
|
settings[caller] = c;
|
|
|
|
$('#set' + caller + ' span').html(c);
|
|
|
|
if( caller == 'bg' ) {
|
|
|
|
$c.first().css('background', c);
|
|
|
|
}
|
2014-02-05 13:02:07 +00:00
|
|
|
})
|
|
|
|
$('.color').val('#000000');
|
|
|
|
|
2014-02-16 14:30:45 +00:00
|
|
|
if( localStorage.getItem('sawTips') != settings.version ) {
|
|
|
|
$('.tour').removeClass('hidden');
|
|
|
|
localStorage.setItem('sawTips', settings.version);
|
|
|
|
}
|
2014-02-05 13:02:07 +00:00
|
|
|
|
2014-02-01 18:18:29 +00:00
|
|
|
})
|