| Issue 1437: | Custom slot sizes for events | |
| 2 people starred this issue and may be notified of changes. | Back to list |
With the patch below, events can have a "dragResizeMinutes" property, which behaves the same as the "slotMinutes" property of the FullCalendar, but allows for different 'slot' sizes for individual events.
{{{
1d0
<
2450c2449
< function dayClick(ev) {
---
> function dayClick(ev) {
3244,3245c3243,3245
< slotHeight = slotTableFirstInner.height() + 1; // +1 for border
<
---
> //slotHeight = slotTableFirstInner.height() + 1; // +1 for border removed by koos van der kolk
> slotHeight = slotTable.height()/slotCnt; /* added by koos van der kolk */
>
3324a3325
>
3330a3332
>
3633a3636
>
4163a4167,4170
> var useSlots = opt('dragResizeMinutes') === undefined ? true : false;
> var dragResizeMinutes = event.dragResizeMinutes === undefined ? opt('dragResizeMinutes') : event.dragResizeMinutes;
> var gridDimensions = useSlots === true ? [colWidth, slotHeight] : [colWidth, (dragResizeMinutes/opt('slotMinutes') * slotHeight)];
>
4167c4174
< grid: [colWidth, slotHeight],
---
> grid: gridDimensions,
4200,4201c4207,4213
< drag: function(ev, ui) {
< minuteDelta = Math.round((ui.position.top - origPosition.top) / slotHeight) * opt('slotMinutes');
---
> drag: function(ev, ui) {
> if (useSlots === true) {
> minuteDelta = Math.round((ui.position.top - origPosition.top) / slotHeight) * opt('slotMinutes');
> } else {
> minuteDelta = Math.round( Math.round((ui.position.top - origPosition.top)/gridDimensions[1]) * gridDimensions[1] * opt('slotMinutes') / slotHeight);
> }
>
4251,4252c4263,4268
< var slotDelta, prevSlotDelta;
< var slotHeight = getSlotHeight();
---
> var useSlots = opt('dragResizeMinutes') === undefined ? true : false;
> var minuteDelta, prevMinuteDelta;
> var slotHeight = getSlotHeight();
> var dragResizeMinutes = event.dragResizeMinutes === undefined ? opt('dragResizeMinutes') : event.dragResizeMinutes;
> var gridHeight = useSlots === true ? slotHeight : (dragResizeMinutes/opt('slotMinutes') * slotHeight);
>
4257c4273
< grid: slotHeight,
---
> grid: gridHeight,
4259c4275
< slotDelta = prevSlotDelta = 0;
---
> minuteDelta = prevMinuteDelta = 0;
4265,4267c4281,4288
< // don't rely on ui.size.height, doesn't take grid into account
< slotDelta = Math.round((Math.max(slotHeight, eventElement.height()) - ui.originalSize.height) / slotHeight);
< if (slotDelta != prevSlotDelta) {
---
> if (useSlots === true) {
> // don't rely on ui.size.height, doesn't take grid into account
> minuteDelta = Math.round((Math.max(slotHeight, eventElement.height()) - ui.originalSize.height) / slotHeight * opt('slotMinutes'));
> } else {
> minuteDelta = Math.round(Math.round((ui.size.height - ui.originalSize.height)/gridHeight) *gridHeight / slotHeight * opt('slotMinutes')) ;
> }
>
> if (minuteDelta != prevMinuteDelta) {
4271,4272c4292,4293
< (!slotDelta && !event.end) ? null : // no change, so don't display time range
< addMinutes(eventEnd(event), opt('slotMinutes')*slotDelta),
---
> (!minuteDelta && !event.end) ? null : // no change, so don't display time range
> addMinutes(eventEnd(event), minuteDelta),
4276c4297,4298
< prevSlotDelta = slotDelta;
---
>
> prevMinuteDelta = minuteDelta;
4281,4283c4303,4306
< if (slotDelta) {
< eventResize(this, event, 0, opt('slotMinutes')*slotDelta, ev, ui);
< }else{
---
>
> if (minuteDelta !== undefined) {
> eventResize(this, event, 0, minuteDelta, ev, ui);
> } else {
5116c5139
< function daySelectionMousedown(ev) { // not really a generic manager method, oh well
---
> function daySelectionMousedown(ev) { // not really a generic manager method, oh well
5215c5238
< }
---
> }
5266a5290
>
}}}
Aug 15, 2013
Project Member
#1
adamrs...@gmail.com
Status:
Done
|
|
| ► Sign in to add a comment |