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

strange things going on with div size #67

Open
embeepea opened this issue May 3, 2013 · 0 comments
Open

strange things going on with div size #67

embeepea opened this issue May 3, 2013 · 0 comments
Labels

Comments

@embeepea
Copy link
Member

embeepea commented May 3, 2013

Sometimes, when creating a graph from a mugl string instead of using ajax to fetch the mugl file, Multigraph's div has a width and/or height of 0 at the time that multigraph inspects the div size, resulting in all kinds of problems. This happens even when the div is given an explicit size in CSS.

See db078ba

and

muglPromise.done(function (data) {
try {
// TODO: div size IS available here; see below. What's going on???!!!
var multigraph = generateInitialGraph(data, options);
deferred.resolve(multigraph);
} catch (e) {
options.messageHandler.error(e);
}
});
return deferred.promise();
};
window.multigraph.core.Multigraph.createCanvasGraphFromString = function (options) {
var deferred;
try {
applyMixins(options);
deferred = $.Deferred();
// TODO: figure this out! div size is not available here? Apparently, at this point in
// code execution, the browser hasn't laid things out enough for the div to have been
// assigned a size, at least sometimes??? But it IS available at the corresponding place in
// createCanvasGraph above? This is worked around by the code in
// src/core/multigraph.js:createGraph() that forces the div to have the size specified in
// the options --- so we can work around the problem by passing an explicit size in the
// options. But we need to really figure out what's going on and resolve it.
var multigraph = generateInitialGraph(options.muglString, options);
deferred.resolve(multigraph);

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

No branches or pull requests

1 participant