samizdatco / arbor

a graph visualization library using web workers and jQuery
http://arborjs.org
2.66k stars 634 forks source link

Fixes for IE #11

Closed gredman closed 11 months ago

gredman commented 13 years ago

I made a few changes in physics/system.js to fix issues in IE. Tested in IE9: as far as I can tell all the demos work now.

Unfortunately, Opera doesn't implement Object.defineProperty, and I'm not really sure how best to fix it.

BenChirlinn commented 13 years ago

So does this version of arbor.js work with the Explorer Canvas js library? I couldn't get it to work before.

gredman commented 13 years ago

Only tested in IE9 (with native canvas), but it might work on IE8 with Explorer Canvas.

The main change is to use Object.defineProperty if possible instead of the deprecated __defineGetter__ and __defineSetter__ which I don't think were ever in IE. defineProperty was only introduced in IE8 so before that it's a bit tricky.

BenChirlinn commented 13 years ago

Doesn't seem so after some fooling around. O well. Just one more question: is there a way I could make it so once a fixed node is added it doesn't move from the position it was added at? While fixed nodes aren't affected by other nodes moving about, they tend to drift around after I add them and settle too close together for my liking. Is there a good way to either make them completely static (except for drag/dropping) and/or keep nodes a specified distance apart? Thanks.

BenChirlinn commented 13 years ago

Getting a strange error still however in IE9:

arbor.js, line 35 character 5831
gredman commented 13 years ago

Hmm, that sounds like something I fixed in one of those commits. Are you sure you're using the very latest?

Could you possibly send me the code to reproduce it? Are the demos working?

BenChirlinn commented 13 years ago

Got it working now. Must have had the original branch. Sorry bout that. Still not working in IE8 with Explorer Canvas but that's probably not even possible.

acajaja commented 12 years ago

Really like this lib (and Traer Physics). The obvious bummer is the lack of IE support. No one hates IE more than me, but if this DOESN'T work in IE only because you made it that way and NOT because there's a lack of support for the functionality itself then I think that's a bad reason. If I wasn't clear about my disdain for IE, let me say it again: I absolutely (expletive) hate IE! If it was up to me, I would not support IE.

Having said that, I'm working on a site that has a page where the client wants some physics stuff happening. They don't want to use the HTML5 canvas or Flash. So I was excited to learn about Arbor and that you leave the rendering to me and just focus on the physics. I thought this was my solution for IE pre 9. But now I'm back to the drawing board.

Not being a physicist or computer scientist I don't really get the details regarding some of the more advanced issues at play here.

Can you explain a little bit about issues preventing IE support previous to IE9?

Also, any ideas how I can pull this off in IE 7 - 8?

BenChirlinn commented 12 years ago

There's no way this could work on pre-IE9 without completely changing how it renders items and then it would probably would look good or function in realtime. Sorry. It has to do with feature support in the browser and not really the implementation.

acajaja commented 12 years ago

No need to be sorry. Unless you are a Microsoft developer, there's no way the failings of IE are in any way your fault.

Thanks for the reply. Are you a developer on this? Sounds like I should re-word "The obvious bummer is the lack of IE support." to "The obvious bummer is the lack of support in IE." I think we're going to make a special page for IE users that just has static content.

BenChirlinn commented 12 years ago

Sounds like a good work around and no I'm not the developer but I recently used the library extensively and as you can see above had a bit of a discussion with the forker.

acajaja commented 12 years ago

Hey primus202, tried to email you. Also posted this as an issue but haven't heard any responses.

I'm having a problem setting the initial x,y of a node ( E.g., addNode({ 'name1' : { x: -10, y: -10 }}); )

wondering if you have any ideas or experience with this. i can set a couple, but it seems that after more than that the system crashes and goes into an infinite loop crashing the browser.

Thanks

BenChirlinn commented 12 years ago

I've found that the best way to add multiple nodes is to do so all at once via the merge method, otherwise things tend to blow up. Beware merge will delete any existing nodes not in the given branch.

To use merge, either loda nodes/edges from a JSON file or create a data object array in the follow way.

var nodes = []; var edges = [];

nodes['name1'] = {'x':-10, 'y':-10}; nodes['name2'] = {'x':10, 'y':10};

edges['name1] = {'name2':{edge vars here}};

Not sure if the quotes around the arguments are required but best to play it safe. I only use the addNode method when I'm adding a small amount of nodes to an existing larger graph. Hope that helps you out.