Skip to content

Commit

Permalink
fix mouse event
Browse files Browse the repository at this point in the history
  • Loading branch information
flyover committed Nov 29, 2021
1 parent dbfdb90 commit 587fb3c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions testbed/build/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion testbed/build/main.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions testbed/dist/testbed.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -13997,8 +13997,8 @@
HandleMouseDown(e) {
const element = new b2__namespace.Vec2(e.clientX, e.clientY);
const world = g_camera.ConvertScreenToWorld(element, new b2__namespace.Vec2());
switch (e.which) {
case 1: // left mouse button
switch (e.button) {
case 0: // left mouse button
this.m_lMouseDown = true;
if (this.m_shift) {
if (this.m_test) {
Expand All @@ -14011,7 +14011,7 @@
}
}
break;
case 3: // right mouse button
case 2: // right mouse button
this.m_rMouseDown = true;
const projection = g_camera.ConvertElementToProjection(element, new b2__namespace.Vec2());
this.m_projection0.Copy(projection);
Expand All @@ -14022,14 +14022,14 @@
HandleMouseUp(e) {
const element = new b2__namespace.Vec2(e.clientX, e.clientY);
const world = g_camera.ConvertScreenToWorld(element, new b2__namespace.Vec2());
switch (e.which) {
case 1: // left mouse button
switch (e.button) {
case 0: // left mouse button
this.m_lMouseDown = false;
if (this.m_test) {
this.m_test.MouseUp(world);
}
break;
case 3: // right mouse button
case 2: // right mouse button
this.m_rMouseDown = false;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion testbed/dist/testbed.umd.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions testbed/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,16 @@ export class Main {
const element: b2.Vec2 = new b2.Vec2(e.clientX, e.clientY);
const world: b2.Vec2 = g_camera.ConvertScreenToWorld(element, new b2.Vec2());

switch (e.which) {
case 1: // left mouse button
switch (e.button) {
case 0: // left mouse button
this.m_lMouseDown = true;
if (this.m_shift) {
if (this.m_test) { this.m_test.ShiftMouseDown(world); }
} else {
if (this.m_test) { this.m_test.MouseDown(world); }
}
break;
case 3: // right mouse button
case 2: // right mouse button
this.m_rMouseDown = true;
const projection: b2.Vec2 = g_camera.ConvertElementToProjection(element, new b2.Vec2());
this.m_projection0.Copy(projection);
Expand All @@ -332,12 +332,12 @@ export class Main {
const element: b2.Vec2 = new b2.Vec2(e.clientX, e.clientY);
const world: b2.Vec2 = g_camera.ConvertScreenToWorld(element, new b2.Vec2());

switch (e.which) {
case 1: // left mouse button
switch (e.button) {
case 0: // left mouse button
this.m_lMouseDown = false;
if (this.m_test) { this.m_test.MouseUp(world); }
break;
case 3: // right mouse button
case 2: // right mouse button
this.m_rMouseDown = false;
break;
}
Expand Down

0 comments on commit 587fb3c

Please sign in to comment.