|
@@ -156,23 +156,12 @@
|
|
|
function draw(){
|
|
|
context.clearRect(0, 0, canvas.width, canvas.height);
|
|
|
for(obj of Object.values(objects)){
|
|
|
- const apexAngle = 35;
|
|
|
- const mediatrice = 300;
|
|
|
-
|
|
|
if (config.app.debugDisplay) {
|
|
|
const apex = {
|
|
|
- x: Math.cos(obj.angle * Math.PI / 180) * (mediatrice / 2) + obj.xPos,
|
|
|
- y: Math.sin(obj.angle * Math.PI / 180) * (mediatrice / 2) + obj.yPos
|
|
|
- };
|
|
|
- const b = {
|
|
|
- x: Math.cos((apexAngle / 2) * Math.PI / 180) * (mediatrice / 2) + apex.x,
|
|
|
- y: Math.sin((apexAngle / 2) * Math.PI / 180) * (mediatrice / 2) + apex.y
|
|
|
+ x: Math.cos(obj.angle * Math.PI /180) * 150 + obj.xPos,
|
|
|
+ y: Math.sin(obj.angle * Math.PI /180) * 150 + obj.yPos
|
|
|
};
|
|
|
- const c = {
|
|
|
- x: Math.cos((-1 * apexAngle / 2) * Math.PI / 180) * (mediatrice / 2) + apex.x,
|
|
|
- y: Math.sin((-1 * apexAngle / 2) * Math.PI / 180) * (mediatrice / 2) + apex.y
|
|
|
- };
|
|
|
- drawTriangle(apex, b, c, {
|
|
|
+ drawIndicationLine(apex, {
|
|
|
x: obj.xPos,
|
|
|
y: obj.yPos
|
|
|
}, obj.symbolId);
|
|
@@ -180,19 +169,14 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const drawTriangle = (a, b, c, center, id) => {
|
|
|
- //
|
|
|
+ const drawIndicationLine = (apex, center, id) => {
|
|
|
const path = new Path2D();
|
|
|
- /*
|
|
|
- path.moveTo(Math.round(a.x), Math.round(a.y));
|
|
|
- path.lineTo(Math.round(b.x), Math.round(b.y));
|
|
|
- path.lineTo(Math.round(c.x), Math.round(c.y));
|
|
|
- */
|
|
|
path.moveTo(Math.round(center.x), Math.round(center.y));
|
|
|
- path.lineTo(Math.round(a.x), Math.round(a.y));
|
|
|
+ path.lineTo(Math.round(apex.x), Math.round(apex.y));
|
|
|
context.stroke(path);
|
|
|
- context.fillText(id, Math.round(a.x), Math.round(a.y));
|
|
|
+ context.fillText(id, Math.round(apex.x), Math.round(apex.y));
|
|
|
};
|
|
|
+
|
|
|
const client = new Tuio.Client({
|
|
|
host: `http://localhost:${config.app.httpPort}`
|
|
|
});
|
|
@@ -204,11 +188,6 @@
|
|
|
},
|
|
|
|
|
|
onAddTuioCursor = function(addCursor) {
|
|
|
- /*
|
|
|
- var $addCursor = $('<div class="tuioCursor"></div>');
|
|
|
- $('body').append($addCursor);
|
|
|
- cursors[addCursor.getCursorId()] = $addCursor;
|
|
|
- */
|
|
|
onUpdateTuioCursor(addCursor);
|
|
|
if (config.app.debug && config.app.debugLog.frontend.receiver.onAddTuioCursor) {
|
|
|
console.log('addTuioCursor', addCursor);
|
|
@@ -216,24 +195,12 @@
|
|
|
},
|
|
|
|
|
|
onUpdateTuioCursor = function(updateCursor) {
|
|
|
- /*
|
|
|
- var $updateCursor = cursors[updateCursor.getCursorId()];
|
|
|
- $updateCursor.css({
|
|
|
- left: updateCursor.getScreenX(screenW),
|
|
|
- top: updateCursor.getScreenY(screenH)
|
|
|
- });
|
|
|
- */
|
|
|
if (config.app.debug && config.app.debugLog.frontend.receiver.onUpdateTuioCursor) {
|
|
|
console.log('updateTuioCursor', updateCursor);
|
|
|
}
|
|
|
},
|
|
|
|
|
|
onRemoveTuioCursor = function(removeCursor) {
|
|
|
- /*
|
|
|
- var $removeCursor = cursors[removeCursor.getCursorId()];
|
|
|
- $removeCursor.remove();
|
|
|
- delete[removeCursor.getCursorId()];
|
|
|
- */
|
|
|
if (config.app.debug && config.app.debugLog.frontend.receiver.onRemoveTuioCursor) {
|
|
|
console.log('removeTuioCursor', removeCursor);
|
|
|
}
|