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

Fixing window resize for explore and standalone #165

Merged
merged 2 commits into from
Mar 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions panoramix/assets/javascripts/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,5 @@ $(document).ready(function () {
});

$('div.toggle').addClass('pull-right');
slice.bindResizeToWindowResize();
});
9 changes: 9 additions & 0 deletions panoramix/assets/javascripts/modules/panoramix.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ var px = (function () {
others += widget.find('.slice_header').height();
return widget.height() - others;
},
bindResizeToWindowResize: function () {
var resizeTimer;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is basically to make sure that the function is called when the resizing is done, as opposed to calling the function a thousand times during the drag event

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, then your browser won't crash :) nit I think bindResizeToWindowResize is a better name but LGTM 👍

$(window).on('resize', function (e) {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function () {
slice.resize();
}, 500);
});
},
render: function () {
$('.btn-group.results span').attr('disabled', 'disabled');
token.find("img.loading").show();
Expand Down
1 change: 1 addition & 0 deletions panoramix/assets/javascripts/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ $(document).ready(function () {
var data = $('.slice').data('slice');
slice = px.Slice(data);
slice.render();
slice.bindResizeToWindowResize();
});