Browse Source

Fix state.me not being set when joining new desk

ssao
A.Olokhtonov 10 months ago
parent
commit
ab7545918b
  1. 4
      README.md
  2. 3
      client/client_recv.js
  3. 32
      client/index.html
  4. 1
      client/webgl_geometry.js
  5. 10
      client/webgl_listeners.js

4
README.md

@ -7,9 +7,9 @@ Release:
- Textured quads (pictures, code already written in older version) - Textured quads (pictures, code already written in older version)
- Resize and move pictures (draw handles) - Resize and move pictures (draw handles)
- Further investigate GC pauses in Firefox - Further investigate GC pauses in Firefox
* Bugs + Bugs
+ GC stalls!!! + GC stalls!!!
- Stroke previews get connected when drawn without panning on touch devices + Stroke previews get connected when drawn without panning on touch devices
- Debug - Debug
- Restore ability to limit event range - Restore ability to limit event range
* Listeners/events/multiplayer * Listeners/events/multiplayer

3
client/client_recv.js

@ -391,10 +391,11 @@ async function handle_message(state, context, d) {
} else { } else {
color = des_u32(d); color = des_u32(d);
width = des_u16(d); width = des_u16(d);
state.me = parseInt(localStorage.getItem('sessionId'));
if (config.debug_print) console.debug('init in'); if (config.debug_print) console.debug('init in');
} }
state.me = parseInt(localStorage.getItem('sessionId'));
init_player_defaults(state, state.me); init_player_defaults(state, state.me);
set_color_u32(state, color); set_color_u32(state, color);

32
client/index.html

@ -7,22 +7,22 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="shortcut icon" href="icons/favicon.svg" id="favicon"> <link rel="shortcut icon" href="icons/favicon.svg" id="favicon">
<link rel="stylesheet" type="text/css" href="default.css?v=71"> <link rel="stylesheet" type="text/css" href="default.css?v=73">
<script type="text/javascript" src="aux.js?v=71"></script> <script type="text/javascript" src="aux.js?v=73"></script>
<script type="text/javascript" src="heapify.js?v=71"></script> <script type="text/javascript" src="heapify.js?v=73"></script>
<script type="text/javascript" src="bvh.js?v=71"></script> <script type="text/javascript" src="bvh.js?v=73"></script>
<script type="text/javascript" src="math.js?v=71"></script> <script type="text/javascript" src="math.js?v=73"></script>
<script type="text/javascript" src="tools.js?v=71"></script> <script type="text/javascript" src="tools.js?v=73"></script>
<script type="text/javascript" src="webgl_geometry.js?v=71"></script> <script type="text/javascript" src="webgl_geometry.js?v=73"></script>
<script type="text/javascript" src="webgl_shaders.js?v=71"></script> <script type="text/javascript" src="webgl_shaders.js?v=73"></script>
<script type="text/javascript" src="webgl_listeners.js?v=71"></script> <script type="text/javascript" src="webgl_listeners.js?v=73"></script>
<script type="text/javascript" src="webgl_draw.js?v=71"></script> <script type="text/javascript" src="webgl_draw.js?v=73"></script>
<script type="text/javascript" src="index.js?v=71"></script> <script type="text/javascript" src="index.js?v=73"></script>
<script type="text/javascript" src="client_send.js?v=71"></script> <script type="text/javascript" src="client_send.js?v=73"></script>
<script type="text/javascript" src="client_recv.js?v=71"></script> <script type="text/javascript" src="client_recv.js?v=73"></script>
<script type="text/javascript" src="websocket.js?v=71"></script> <script type="text/javascript" src="websocket.js?v=73"></script>
</head> </head>
<body> <body>
<div class="main"> <div class="main">

1
client/webgl_geometry.js

@ -311,7 +311,6 @@ function geometry_clear_player(state, context, player_id) {
if (!state.online) return; if (!state.online) return;
state.players[player_id].points.length = 0; state.players[player_id].points.length = 0;
recompute_dynamic_data(state, context); recompute_dynamic_data(state, context);
schedule_draw(state, context);
} }
function add_image(context, image_id, bitmap, p) { function add_image(context, image_id, bitmap, p) {

10
client/webgl_listeners.js

@ -3,10 +3,10 @@ function init_listeners(state, context) {
window.addEventListener('keyup', (e) => keyup(e, state, context)); window.addEventListener('keyup', (e) => keyup(e, state, context));
window.addEventListener('paste', (e) => paste(e, state, context)); window.addEventListener('paste', (e) => paste(e, state, context));
context.canvas.addEventListener('mousedown', (e) => mousedown(e, state, context)); context.canvas.addEventListener('pointerdown', (e) => mousedown(e, state, context));
context.canvas.addEventListener('mousemove', (e) => mousemove(e, state, context)); context.canvas.addEventListener('pointermove', (e) => mousemove(e, state, context));
context.canvas.addEventListener('mouseup', (e) => mouseup(e, state, context)); context.canvas.addEventListener('pointerup', (e) => mouseup(e, state, context));
context.canvas.addEventListener('mouseleave', (e) => mouseup(e, state, context)); context.canvas.addEventListener('pointerleave', (e) => mouseup(e, state, context));
context.canvas.addEventListener('contextmenu', cancel); context.canvas.addEventListener('contextmenu', cancel);
context.canvas.addEventListener('wheel', (e) => wheel(e, state, context)); context.canvas.addEventListener('wheel', (e) => wheel(e, state, context));
@ -246,6 +246,7 @@ function mousemove(e, state, context) {
} }
if (state.drawing) { if (state.drawing) {
//console.log(e.pressure);
geometry_add_point(state, context, state.me, canvasp); geometry_add_point(state, context, state.me, canvasp);
fire_event(state, predraw_event(canvasp.x, canvasp.y)); fire_event(state, predraw_event(canvasp.x, canvasp.y));
do_draw = true; do_draw = true;
@ -518,6 +519,7 @@ function touchend(e, state, context) {
if (stroke) { if (stroke) {
queue_event(state, stroke_event(state)); queue_event(state, stroke_event(state));
//geometry_clear_player(state, context, state.me);
schedule_draw(state, context); schedule_draw(state, context);
} }

Loading…
Cancel
Save