|
|
|
@ -56,6 +56,8 @@ export function startup() {
@@ -56,6 +56,8 @@ export function startup() {
|
|
|
|
|
id INTEGER PRIMARY KEY, |
|
|
|
|
desk_id INTEGER, |
|
|
|
|
points BLOB, |
|
|
|
|
width INTEGER, |
|
|
|
|
color INTEGER, |
|
|
|
|
|
|
|
|
|
FOREIGN KEY (desk_id) |
|
|
|
|
REFERENCES desks (id) |
|
|
|
@ -112,10 +114,10 @@ export function startup() {
@@ -112,10 +114,10 @@ export function startup() {
|
|
|
|
|
queries.desks = db.query('SELECT id, sn FROM desks'); |
|
|
|
|
queries.events = db.query('SELECT * FROM events'); |
|
|
|
|
queries.sessions = db.query('SELECT id, lsn, user_id, desk_id FROM sessions'); |
|
|
|
|
queries.strokes = db.query('SELECT id, points FROM strokes'); |
|
|
|
|
queries.strokes = db.query('SELECT * FROM strokes'); |
|
|
|
|
queries.empty_desk = db.query('INSERT INTO desks (id, title, sn) VALUES (?1, ?2, 0)'); |
|
|
|
|
queries.desk_strokes = db.query('SELECT id, points FROM strokes WHERE desk_id = ?1'); |
|
|
|
|
queries.put_desk_stroke = db.query('INSERT INTO strokes (id, desk_id, points) VALUES (?1, ?2, ?3)'); |
|
|
|
|
queries.put_desk_stroke = db.query('INSERT INTO strokes (id, desk_id, points, width, color) VALUES (?1, ?2, ?3, ?4, ?5)'); |
|
|
|
|
queries.clear_desk_events = db.query('DELETE FROM events WHERE desk_id = ?1'); |
|
|
|
|
queries.set_desk_sn = db.query('UPDATE desks SET sn = ?1 WHERE id = ?2'); |
|
|
|
|
queries.save_session_lsn = db.query('UPDATE sessions SET lsn = ?1 WHERE id = ?2'); |
|
|
|
@ -153,7 +155,10 @@ export function startup() {
@@ -153,7 +155,10 @@ export function startup() {
|
|
|
|
|
|
|
|
|
|
for (const event of stored_events) { |
|
|
|
|
if (event.type === EVENT.STROKE) { |
|
|
|
|
event.points = stroke_dict[event.stroke_id].points; |
|
|
|
|
const stroke = stroke_dict[event.stroke_id]; |
|
|
|
|
event.points = stroke.points; |
|
|
|
|
event.color = stroke.color; |
|
|
|
|
event.width = stroke.width; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -191,8 +196,8 @@ export function put_event(event) {
@@ -191,8 +196,8 @@ export function put_event(event) {
|
|
|
|
|
return queries.put_event.get(event.type, event.desk_id || 0, event.user_id || 0, event.stroke_id || 0, event.image_id || 0, event.x || 0, event.y || 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function put_stroke(stroke_id, desk_id, points) { |
|
|
|
|
return queries.put_desk_stroke.get(stroke_id, desk_id, new Uint8Array(points.buffer, points.byteOffset, points.byteLength)); |
|
|
|
|
export function put_stroke(stroke_id, desk_id, points, width, color) { |
|
|
|
|
return queries.put_desk_stroke.get(stroke_id, desk_id, new Uint8Array(points.buffer, points.byteOffset, points.byteLength), width, color); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function clear_events(desk_id) { |
|
|
|
|