Skip to content

Commit

Permalink
build v1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
shakiba committed Dec 18, 2024
1 parent 7d09b35 commit c11f049
Show file tree
Hide file tree
Showing 16 changed files with 152 additions and 112 deletions.
30 changes: 17 additions & 13 deletions dist/planck-with-testbed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ export declare class Vec2 {
static lower(v: Vec2Value, w: Vec2Value): Vec2;
clamp(max: number): Vec2;
static clamp(v: Vec2Value, max: number): Vec2;
/** @hidden */
static clampVec2(v: Vec2Value, min?: Vec2, max?: Vec2): Vec2Value;
/** @hidden @deprecated */
static scaleFn(x: number, y: number): (v: Vec2Value) => Vec2;
/** @hidden @deprecated */
Expand Down Expand Up @@ -579,7 +581,9 @@ export type KEY = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "A
export type ActiveKeys = {
[key in KEY]?: boolean;
};
export type TestbedMountOptions = {};
export type TestbedMountOptions = {
[key: string]: any;
};
export declare abstract class Testbed {
/**
* Mounts testbed. Call start with a world to start simulation and rendering.
Expand Down Expand Up @@ -649,7 +653,7 @@ export declare abstract class Testbed {
abstract findOne(query: string): (Body$1 | Joint | Fixture | null);
abstract findAll(query: string): (Body$1 | Joint | Fixture)[];
}
export type TestbedFactoryOptions = string | {};
export type TestbedFactoryOptions = string | TestbedMountOptions;
/** @deprecated */
export type TestbedCallback = (testbed: Testbed) => (World | undefined);
/** @deprecated */
Expand Down Expand Up @@ -2717,7 +2721,7 @@ export declare class DistanceJoint extends Joint {
* @param anchorA Anchor A in global coordination.
* @param anchorB Anchor B in global coordination.
*/
constructor(def: DistanceJointOpt, bodyA: Body$1, bodyB: Body$1, anchorA: Vec2Value, anchorB: Vec2Value);
constructor(def: DistanceJointOpt, bodyA: Body$1, bodyB: Body$1, anchorA?: Vec2Value, anchorB?: Vec2Value);
/** @hidden */
_reset(def: Partial<DistanceJointDef>): void;
/**
Expand Down Expand Up @@ -2804,7 +2808,7 @@ export declare class FrictionJoint extends Joint {
/**
* @param anchor Anchor in global coordination.
*/
constructor(def: FrictionJointOpt, bodyA: Body$1, bodyB: Body$1, anchor: Vec2Value);
constructor(def: FrictionJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value);
/** @hidden */
_reset(def: Partial<FrictionJointDef>): void;
/**
Expand Down Expand Up @@ -2917,7 +2921,7 @@ export interface RevoluteJointDef extends JointDef, RevoluteJointOpt {
/**
* The bodyB angle minus bodyA angle in the reference state (radians).
*/
referenceAngle: number;
referenceAngle?: number;
}
/** @hidden @deprecated Use new keyword. */
export function RevoluteJoint(def: RevoluteJointDef): RevoluteJoint;
Expand All @@ -2934,7 +2938,7 @@ export function RevoluteJoint(def: RevoluteJointOpt, bodyA: Body$1, bodyB: Body$
export declare class RevoluteJoint extends Joint {
static TYPE: "revolute-joint";
constructor(def: RevoluteJointDef);
constructor(def: RevoluteJointOpt, bodyA: Body$1, bodyB: Body$1, anchor: Vec2Value);
constructor(def: RevoluteJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value);
/** @hidden */
_reset(def: Partial<RevoluteJointDef>): void;
/**
Expand Down Expand Up @@ -3085,7 +3089,7 @@ export interface PrismaticJointDef extends JointDef, PrismaticJointOpt {
* referenceAngle The constrained angle between the bodies:
* bodyB_angle - bodyA_angle.
*/
referenceAngle: number;
referenceAngle?: number;
}
/** @hidden @deprecated Use new keyword. */
export function PrismaticJoint(def: PrismaticJointDef): PrismaticJoint;
Expand All @@ -3100,7 +3104,7 @@ export function PrismaticJoint(def: PrismaticJointOpt, bodyA: Body$1, bodyB: Bod
export declare class PrismaticJoint extends Joint {
static TYPE: "prismatic-joint";
constructor(def: PrismaticJointDef);
constructor(def: PrismaticJointOpt, bodyA: Body$1, bodyB: Body$1, anchor: Vec2Value, axis: Vec2Value);
constructor(def: PrismaticJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value, axis?: Vec2Value);
/** @hidden */
_reset(def: Partial<PrismaticJointDef>): void;
/**
Expand Down Expand Up @@ -3432,7 +3436,7 @@ export function MouseJoint(def: MouseJointOpt, bodyA: Body$1, bodyB: Body$1, tar
export declare class MouseJoint extends Joint {
static TYPE: "mouse-joint";
constructor(def: MouseJointDef);
constructor(def: MouseJointOpt, bodyA: Body$1, bodyB: Body$1, target: Vec2Value);
constructor(def: MouseJointOpt, bodyA: Body$1, bodyB: Body$1, target?: Vec2Value);
/** @hidden */
_reset(def: Partial<MouseJointDef>): void;
/**
Expand Down Expand Up @@ -3551,7 +3555,7 @@ export function PulleyJoint(def: PulleyJointOpt, bodyA: Body$1, bodyB: Body$1, g
export declare class PulleyJoint extends Joint {
static TYPE: "pulley-joint";
constructor(def: PulleyJointDef);
constructor(def: PulleyJointOpt, bodyA: Body$1, bodyB: Body$1, groundA: Vec2Value, groundB: Vec2Value, anchorA: Vec2Value, anchorB: Vec2Value, ratio: number);
constructor(def: PulleyJointOpt, bodyA: Body$1, bodyB: Body$1, groundA?: Vec2Value, groundB?: Vec2Value, anchorA?: Vec2Value, anchorB?: Vec2Value, ratio?: number);
/** @hidden */
_reset(def: Partial<PulleyJointDef>): void;
/**
Expand Down Expand Up @@ -3656,7 +3660,7 @@ export function RopeJoint(def: RopeJointOpt, bodyA: Body$1, bodyB: Body$1, ancho
export declare class RopeJoint extends Joint {
static TYPE: "rope-joint";
constructor(def: RopeJointDef);
constructor(def: RopeJointOpt, bodyA: Body$1, bodyB: Body$1, anchor: Vec2Value);
constructor(def: RopeJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value);
/** @hidden */
_reset(def: Partial<RopeJointDef>): void;
/**
Expand Down Expand Up @@ -3745,7 +3749,7 @@ export function WeldJoint(def: WeldJointOpt, bodyA: Body$1, bodyB: Body$1, ancho
export declare class WeldJoint extends Joint {
static TYPE: "weld-joint";
constructor(def: WeldJointDef);
constructor(def: WeldJointOpt, bodyA: Body$1, bodyB: Body$1, anchor: Vec2Value);
constructor(def: WeldJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value);
/** @hidden */
_reset(def: Partial<WeldJointDef>): void;
/**
Expand Down Expand Up @@ -3864,7 +3868,7 @@ export function WheelJoint(def: WheelJointOpt, bodyA: Body$1, bodyB: Body$1, anc
export declare class WheelJoint extends Joint {
static TYPE: "wheel-joint";
constructor(def: WheelJointDef);
constructor(def: WheelJointOpt, bodyA: Body$1, bodyB: Body$1, anchor: Vec2Value, axis: Vec2Value);
constructor(def: WheelJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value, axis?: Vec2Value);
/** @hidden */
_reset(def: Partial<WheelJointDef>): void;
/**
Expand Down
53 changes: 33 additions & 20 deletions dist/planck-with-testbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.planck = {}));
})(this, function(exports2) {
"use strict";/**
* Planck.js v1.1.2
* Planck.js v1.1.3
* @license The MIT license
* @copyright Copyright (c) 2024 Erin Catto, Ali Shakiba
*
Expand Down Expand Up @@ -445,6 +445,12 @@
r.clamp(max);
return r;
};
Vec22.clampVec2 = function(v3, min, max) {
return {
x: clamp$1(v3.x, min === null || min === void 0 ? void 0 : min.x, max === null || max === void 0 ? void 0 : max.x),
y: clamp$1(v3.y, min === null || min === void 0 ? void 0 : min.y, max === null || max === void 0 ? void 0 : max.y)
};
};
Vec22.scaleFn = function(x2, y) {
return function(v3) {
return Vec22.neo(v3.x * x2, v3.y * y);
Expand Down Expand Up @@ -2179,7 +2185,6 @@
this.aabb = new AABB();
this.fixture = fixture;
this.childIndex = childIndex;
this.proxyId;
}
return FixtureProxy2;
}()
Expand Down Expand Up @@ -10043,14 +10048,6 @@
_this.m_impulse = new Vec3();
_this.m_bias = 0;
_this.m_gamma = 0;
_this.m_rA;
_this.m_rB;
_this.m_localCenterA;
_this.m_localCenterB;
_this.m_invMassA;
_this.m_invMassB;
_this.m_invIA;
_this.m_invIB;
_this.m_mass = new Mat33();
return _this;
}
Expand Down Expand Up @@ -11129,7 +11126,8 @@
manifold.type = exports2.ManifoldType.e_faceA;
flip = false;
}
incidentEdge[0].recycle(), incidentEdge[1].recycle();
incidentEdge[0].recycle();
incidentEdge[1].recycle();
findIncidentEdge(incidentEdge, poly1, xf1, edge12, poly2, xf2);
var count1 = poly1.m_count;
var vertices1 = poly1.m_vertices;
Expand All @@ -11148,8 +11146,10 @@
var frontOffset = dotVec2(normal$1, v11);
var sideOffset1 = -dotVec2(tangent, v11) + totalRadius;
var sideOffset2 = dotVec2(tangent, v12) + totalRadius;
clipPoints1$1[0].recycle(), clipPoints1$1[1].recycle();
clipPoints2$1[0].recycle(), clipPoints2$1[1].recycle();
clipPoints1$1[0].recycle();
clipPoints1$1[1].recycle();
clipPoints2$1[0].recycle();
clipPoints2$1[1].recycle();
setVec2(clipSegmentToLineNormal, -tangent.x, -tangent.y);
var np1 = clipSegmentToLine(clipPoints1$1, incidentEdge, clipSegmentToLineNormal, sideOffset1, iv1);
if (np1 < 2) {
Expand Down Expand Up @@ -11553,7 +11553,8 @@
} else {
primaryAxis = edgeAxis;
}
ie[0].recycle(), ie[1].recycle();
ie[0].recycle();
ie[1].recycle();
if (primaryAxis.type == EPAxisType.e_edgeA) {
manifold.type = exports2.ManifoldType.e_faceA;
var bestIndex = 0;
Expand Down Expand Up @@ -11600,8 +11601,10 @@
setVec2(rf.sideNormal2, -rf.sideNormal1.x, -rf.sideNormal1.y);
rf.sideOffset1 = dotVec2(rf.sideNormal1, rf.v1);
rf.sideOffset2 = dotVec2(rf.sideNormal2, rf.v2);
clipPoints1[0].recycle(), clipPoints1[1].recycle();
clipPoints2[0].recycle(), clipPoints2[1].recycle();
clipPoints1[0].recycle();
clipPoints1[1].recycle();
clipPoints2[0].recycle();
clipPoints2[1].recycle();
var np1 = clipSegmentToLine(clipPoints1, ie, rf.sideNormal1, rf.sideOffset1, rf.i1);
if (np1 < SettingsInternal.maxManifoldPoints) {
return;
Expand Down Expand Up @@ -15185,7 +15188,11 @@
var infoElement = document.getElementById("testbed-info");
if (playButton) {
playButton.addEventListener("click", function() {
mounted.isPaused() ? mounted.resume() : mounted.pause();
if (mounted.isPaused()) {
mounted.resume();
} else {
mounted.pause();
}
});
mounted._pause = function() {
playButton.classList.add("pause");
Expand Down Expand Up @@ -15394,16 +15401,18 @@
activeKeys.fire = downKeys[32] || downKeys[13];
}
window.addEventListener("keydown", function(e3) {
var _a2;
var keyCode = e3.keyCode;
downKeys[keyCode] = true;
updateActiveKeys(keyCode, true);
testbed2.keydown && testbed2.keydown(keyCode, String.fromCharCode(keyCode));
(_a2 = testbed2.keydown) === null || _a2 === void 0 ? void 0 : _a2.call(testbed2, keyCode, String.fromCharCode(keyCode));
});
window.addEventListener("keyup", function(e3) {
var _a2;
var keyCode = e3.keyCode;
downKeys[keyCode] = false;
updateActiveKeys(keyCode, false);
testbed2.keyup && testbed2.keyup(keyCode, String.fromCharCode(keyCode));
(_a2 = testbed2.keyup) === null || _a2 === void 0 ? void 0 : _a2.call(testbed2, keyCode, String.fromCharCode(keyCode));
});
this.resume();
};
Expand Down Expand Up @@ -15453,7 +15462,11 @@
return this.paused;
};
StageTestbed2.prototype.togglePause = function() {
this.paused ? this.resume() : this.pause();
if (this.paused) {
this.resume();
} else {
this.pause();
}
};
StageTestbed2.prototype.pause = function() {
this.stage.pause();
Expand Down
2 changes: 1 addition & 1 deletion dist/planck-with-testbed.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/planck-with-testbed.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/planck-with-testbed.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit c11f049

Please sign in to comment.