mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-07-19 11:23:32 +08:00
dont mistake a jqui resize event for a window resize event
This commit is contained in:
+6
-3
@@ -486,8 +486,11 @@ function Calendar(element, instanceOptions) {
|
||||
}
|
||||
|
||||
|
||||
function windowResize() {
|
||||
if (!ignoreWindowResize) {
|
||||
function windowResize(ev) {
|
||||
if (
|
||||
!ignoreWindowResize &&
|
||||
ev.target === window // so we don't process jqui "resize" events that have bubbled up
|
||||
) {
|
||||
if (currentView.start) { // view has already been rendered
|
||||
var uid = ++resizeUID;
|
||||
setTimeout(function() { // add a delay
|
||||
@@ -499,7 +502,7 @@ function Calendar(element, instanceOptions) {
|
||||
ignoreWindowResize--;
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
}, options.windowResizeDelay);
|
||||
}else{
|
||||
// calendar must have been initialized in a 0x0 iframe that has just been resized
|
||||
lateRender();
|
||||
|
||||
+2
-1
@@ -89,7 +89,8 @@ var defaults = {
|
||||
|
||||
dropAccept: '*',
|
||||
|
||||
handleWindowResize: true
|
||||
handleWindowResize: true,
|
||||
windowResizeDelay: 200 // milliseconds before a rerender happens
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -184,6 +184,29 @@ describe('eventResize', function() {
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should not fire the windowResize handler', function(done) { // bug 1116
|
||||
options.windowResize = function() { };
|
||||
options.windowResizeDelay = 0;
|
||||
spyOn(options, 'windowResize');
|
||||
init(
|
||||
function() {
|
||||
$('.fc-event .ui-resizable-handle')
|
||||
.simulate('mouseover') // for our dumb optimization
|
||||
.simulate('drag-n-drop', {
|
||||
dy: 200,
|
||||
interpolation: {
|
||||
stepCount: 10,
|
||||
duration: 100
|
||||
}
|
||||
});
|
||||
},
|
||||
function() { // if an unintended rerender happened, won't get here anyway
|
||||
expect(options.windowResize).not.toHaveBeenCalled();
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when resizing a timed event without an end', function() {
|
||||
|
||||
Reference in New Issue
Block a user