fixed issue 517

This commit is contained in:
Adam Shaw 2010-10-11 18:05:32 -07:00
parent 453fcf07e3
commit 1176a7479e
4 changed files with 133 additions and 5 deletions

View file

@ -269,8 +269,9 @@ function AgendaEventRenderer() {
for (i=0; i<segCnt; i++) { for (i=0; i<segCnt; i++) {
seg = segs[i]; seg = segs[i];
if (eventElement = seg.element) { if (eventElement = seg.element) {
eventElement[0].style.width = seg.outerWidth - seg.hsides + 'px'; eventElement[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px';
eventElement[0].style.height = (height = seg.outerHeight - seg.vsides) + 'px'; height = Math.max(0, seg.outerHeight - seg.vsides);
eventElement[0].style.height = height + 'px';
event = seg.event; event = seg.event;
if (seg.titleTop !== undefined && height - seg.titleTop < 10) { if (seg.titleTop !== undefined && height - seg.titleTop < 10) {
// not enough room for title, put it in the time header // not enough room for title, put it in the time header

View file

@ -144,7 +144,7 @@ function DayEventRenderer() {
for (i=0; i<segCnt; i++) { for (i=0; i<segCnt; i++) {
seg = segs[i]; seg = segs[i];
if (eventElement = seg.element) { if (eventElement = seg.element) {
eventElement[0].style.width = seg.outerWidth - seg.hsides + 'px'; eventElement[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px';
} }
} }

View file

@ -139,14 +139,14 @@ function lazySegBind(container, segs, bindHandlers) {
function setOuterWidth(element, width, includeMargins) { function setOuterWidth(element, width, includeMargins) {
element.each(function(i, _element) { element.each(function(i, _element) {
_element.style.width = width - hsides(_element, includeMargins) + 'px'; _element.style.width = Math.max(0, width - hsides(_element, includeMargins)) + 'px';
}); });
} }
function setOuterHeight(element, height, includeMargins) { function setOuterHeight(element, height, includeMargins) {
element.each(function(i, _element) { element.each(function(i, _element) {
_element.style.height = height - vsides(_element, includeMargins) + 'px'; _element.style.height = Math.max(0, height - vsides(_element, includeMargins)) + 'px';
}); });
} }

View file

@ -0,0 +1,127 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script type='text/javascript' src='../src/_loader.js?debug'></script>
<script type='text/javascript'>
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
},
defaultView: 'agendaWeek',
events: [
{
title: 'Event1',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event2',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event3',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event4',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event5',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event6',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event7',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event8',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event9',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event10',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event11',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event12',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event13',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event14',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event15',
start: new Date(y, m, d, 6, 0),
allDay : false
},
{
title: 'Event16',
start: new Date(y, m, d, 6, 0),
allDay : false
}
]
});
});
</script>
<style type='text/css'>
body {
margin-top: 40px;
text-align: center;
font-size: 13px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 400px;
margin: 0 auto;
}
</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>