Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide rubber band when dragging #10

Closed
run-time opened this issue Mar 18, 2014 · 5 comments
Closed

Hide rubber band when dragging #10

run-time opened this issue Mar 18, 2014 · 5 comments

Comments

@run-time
Copy link

I love all the options for turning various mechanics on/off but couldn't find one for the little green rubber band that shows up when dragging a shape. can i change the color or hide this easily?

@liabru
Copy link
Owner

liabru commented Apr 1, 2014

Hi,

Sorry for the delayed response.

The latest release:
https://github.com/liabru/matter-js/releases/tag/0.7.0-alpha

Allows you to change constraint colours or make them invisible, using the constraint properties under render, e.g.

var constraint = Constraint.create({
    render: {
        visible: true,
        lineWidth: 2,
        strokeStyle: '#666'
    }
});

Or after creation e.g.:

 constraint.render.visible = false;

The latest release no longer includes the MouseConstraint by default, so you have to create and add one yourself like so:

 var mouseConstraint = MouseConstraint.create(engine);
 mouseConstraint.render.visible = false;
 World.add(engine.world, mouseConstraint);

Hope that answers your question, cheers!

@liabru
Copy link
Owner

liabru commented Apr 17, 2014

I think the above should have solved your problem, so I'll close this for now, but feel free to reply if it didn't

@liabru liabru closed this as completed Apr 17, 2014
@stephenDyksen
Copy link

I tried adding the render.visible = false line to my code, but could not seem to get it working. I am not sure there is a render object on the mouseConstraint.

In my code I have exactly:

var mouseConstraint = MouseConstraint.create(engine);
mouseConstraint.render.visible = false;
World.add(engine.world, mouseConstraint);

Am I missing something?

@liabru
Copy link
Owner

liabru commented Mar 30, 2015

@stephenDyksen see #72

@stephenDyksen
Copy link

It worked...Excellent! Thanks for the help, and the fast reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants