Skip to content

Commit

Permalink
resize event to different week (issue 308), necessary event rendering…
Browse files Browse the repository at this point in the history
… refactoring
  • Loading branch information
arshaw committed Nov 10, 2010
1 parent c1a19a2 commit 64b84cc
Show file tree
Hide file tree
Showing 7 changed files with 311 additions and 104 deletions.
3 changes: 2 additions & 1 deletion src/agenda/AgendaEventRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ function AgendaEventRenderer() {

// exports
t.renderEvents = renderEvents;
t.compileDaySegs = compileDaySegs; // for DayEventRenderer
t.clearEvents = clearEvents;
t.slotSegHtml = slotSegHtml;
t.bindDaySeg = bindDaySeg;
Expand Down Expand Up @@ -296,7 +297,7 @@ function AgendaEventRenderer() {
if (event.editable || event.editable === undefined && opt('editable')) {
draggableDayEvent(event, eventElement, seg.isStart);
if (seg.isEnd) {
resizableDayEvent(event, eventElement, getColWidth());
resizableDayEvent(event, eventElement, seg);
}
}
}
Expand Down
11 changes: 10 additions & 1 deletion src/agenda/AgendaView.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function AgendaView(element, calendar, viewName) {
t.defaultEventEnd = defaultEventEnd;
t.timePosition = timePosition;
t.dayOfWeekCol = dayOfWeekCol;
t.dateCell = dateCell;
t.cellDate = cellDate;
t.cellIsAllDay = cellIsAllDay;
t.allDayTR = allDayTR;
Expand Down Expand Up @@ -493,7 +494,15 @@ function AgendaView(element, calendar, viewName) {


function dayOfWeekCol(dayOfWeek) {
return ((dayOfWeek - Math.max(firstDay,nwe)+colCnt) % colCnt)*dis+dit;
return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt)*dis+dit;
}


function dateCell(date) {
return {
row: Math.floor(dayDiff(date, t.visStart) / 7),
col: dayOfWeekCol(date.getDay())
};
}


Expand Down
3 changes: 2 additions & 1 deletion src/basic/BasicEventRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ function BasicEventRenderer() {

// exports
t.renderEvents = renderEvents;
t.compileDaySegs = compileSegs; // for DayEventRenderer
t.clearEvents = clearEvents;
t.bindDaySeg = bindDaySeg;

Expand Down Expand Up @@ -79,7 +80,7 @@ function BasicEventRenderer() {
if (event.editable || event.editable === undefined && opt('editable')) {
draggableDayEvent(event, eventElement);
if (seg.isEnd) {
resizableDayEvent(event, eventElement);
resizableDayEvent(event, eventElement, seg);
}
}
}
Expand Down
13 changes: 11 additions & 2 deletions src/basic/BasicView.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function BasicView(element, calendar, viewName) {
t.colContentLeft = colContentLeft;
t.colContentRight = colContentRight;
t.dayOfWeekCol = dayOfWeekCol;
t.dateCell = dateCell;
t.cellDate = cellDate;
t.cellIsAllDay = function() { return true };
t.allDayTR = allDayTR;
Expand Down Expand Up @@ -335,7 +336,7 @@ function BasicView(element, calendar, viewName) {


function renderSelection(startDate, endDate, allDay) {
renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true);
renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); // rebuild every time???
}


Expand Down Expand Up @@ -427,7 +428,15 @@ function BasicView(element, calendar, viewName) {


function dayOfWeekCol(dayOfWeek) {
return (dayOfWeek - Math.max(firstDay,nwe)+colCnt) % colCnt;
return (dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt;
}


function dateCell(date) {
return {
row: Math.floor(dayDiff(date, t.visStart) / 7),
col: dayOfWeekCol(date.getDay())*dis + dit
};
}


Expand Down
Loading

0 comments on commit 64b84cc

Please sign in to comment.