robmonie / jquery-week-calendar

Now actively maintained in the following fork - https://github.com/themouette/jquery-week-calendar
388 stars 391 forks source link

Possible error on _addDroppableToWeekDay #10

Open pipothebit opened 14 years ago

pipothebit commented 14 years ago

Hi All adn sorry fr my english, I think that I have found a little error on function _addDroppableToWeekDay where top calcutations are done. Actual code only uses ui.position.top to calculate the time slot to drop the new element but not the scroll of wc-scrollable-grid. This causes that all events are placed starting at 00:00.

I have made a little change to prevent this, next my code: var headerHeight = self.element.find(".wc-header").outerHeight(); var navHeight = self.element.find(".wc-nav").outerHeight(); navHeight = navHeight == null ? 0 : navHeight; var $scrollable = self.element.find(".wc-scrollable-grid"); var top = ($scrollable.scrollTop() - (headerHeight + navHeight)) + Math.round(parseInt(ui.position.top)); var eventDuration = self._getEventDurationFromPositionedEventElement($weekDay, $calEvent, top);

I am using v 1.2.2 and with this change I put correct my event when I drop it over weekcalendar.