Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as Matter from 'matter-js'
// Matter.js module aliases
const consts = {
Engine: Matter.Engine,
World: Matter.World,
Body: Matter.Body,
Bodies: Matter.Bodies,
Events: Matter.Events,
Vector: Matter.Vector,
Composite: Matter.Composite
}
export default consts
// 木偶人对战画面, 效率太低, 废弃;
let Matter = require('matter-js');
var Engine = Matter.Engine,
Render = Matter.Render,
Runner = Matter.Runner,
Body = Matter.Body,
Constraint = Matter.Constraint,
MouseConstraint = Matter.MouseConstraint,
Mouse = Matter.Mouse,
World = Matter.World,
Bodies = Matter.Bodies,
Composites = Matter.Composites,
Composite = Matter.Composite,
Events = Matter.Events;
Composites.Person = function(x, y, ){
let group = Body.nextGroup(true),
Person = Composite.create({ label: 'Person'}),
radius = 2;
var options = {
collisionFilter: {
group: group
},
chamfer : {
radius: 4
}
}
.forEach(key => {
Matter.Composite.remove(world, state[key].body);
delete state[key];
});
/**
* A tool for inspecting worlds.
* @module Inspector
*/
const Inspector = module.exports = {};
const $ = require('jquery');
require('../../node_modules/jstree/dist/jstree.min');
const ToolsCommon = require('./Common');
const Serializer = require('matter-tools').Serializer;
const km = require('keymaster');
const Matter = require('matter-js');
const Body = Matter.Body;
const Bounds = Matter.Bounds;
const Composite = Matter.Composite;
const Common = Matter.Common;
const Events = Matter.Events;
const Mouse = Matter.Mouse;
const Query = Matter.Query;
const Vertices = Matter.Vertices;
const Vector = Matter.Vector;
const MouseConstraint = Matter.MouseConstraint;
var $body;
/**
* Creates an inspector
* @function Gui.create
* @param {engine} engine
* @param {render} [render]
* @param {object} options
* @module Gui
*/
var Gui = module.exports = {};
const dat = require('../../node_modules/dat.gui/build/dat.gui.min');
const ToolsCommon = require('./Common');
const Serializer = require('matter-tools').Serializer;
const Matter = require('matter-js');
const Engine = Matter.Engine;
const Detector = Matter.Detector;
const Grid = Matter.Grid;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Events = Matter.Events;
const Composite = Matter.Composite;
/**
* Creates a Gui
* @function Gui.create
* @param {engine} [engine]
* @param {runner} [runner]
* @param {render} [render]
* @return {gui} The created gui instance
*/
Gui.create = function(engine, runner, render) {
dat.GUI.TEXT_CLOSED = '▲';
dat.GUI.TEXT_OPEN = '▼';
var datGui = new dat.GUI({ autoPlace: false });
var gui = {