| 40 | | // public var showHourLabels:Boolean = false; |
| 41 | | // |
| 42 | | // private var hourLabels:HashArray = new HashArray(); |
| 43 | | // |
| 44 | | // override protected function createChildren():void{ |
| 45 | | // super.createChildren(); |
| 46 | | // |
| 47 | | // if(showHourLabels){ |
| 48 | | // var score:int; |
| 49 | | // var el:Label; |
| 50 | | // for(var i:int=0; i<=24; i++){ |
| 51 | | // el = new Label(); |
| 52 | | // el.id = el.text = ((i<10)?("0"+i):(i))+":00"; |
| 53 | | // |
| 54 | | // if( !hourLabels.containsKey(el.id) ){ |
| 55 | | // |
| 56 | | // this.addChild( el ); |
| 57 | | // |
| 58 | | // el.setStyle("textAlign","right"); |
| 59 | | // el.setStyle("color", 0x000000); |
| 60 | | // el.setStyle("fontSize", 11); |
| 61 | | // el.visible = el.includeInLayout = false;//((i%24) == 0); |
| 62 | | // score = 0x20; |
| 63 | | // if(i%24 == 0) score |= 0x01; |
| 64 | | // if(i%12 == 0) score |= 0x02; |
| 65 | | // if(i%6 == 0) score |= 0x04; |
| 66 | | // if(i%3 == 0) score |= 0x08; |
| 67 | | // if(i%2 == 0) score |= 0x10; |
| 68 | | // |
| 69 | | // hourLabels.put( el.id, { score:score, element:el } ); |
| 70 | | // |
| 71 | | // } |
| 72 | | // } |
| 73 | | // } |
| 74 | | // |
| 75 | | // } |
| | 41 | public var currentDay:Date; |
| 79 | | // call first in order to get grid drawn correctly |
| 80 | | super.updateDisplayList(unscaledWidth, unscaledHeight); |
| 81 | | |
| 82 | | // do not erase old drawings! |
| 83 | | //graphics.clear(); |
| 84 | | |
| 85 | | // if(showHourLabels && hourLabels.size>0){ // added |
| 86 | | // |
| 87 | | // var textHeight:int = (hourLabels.getValueAt(0).element as Label).textHeight; // label text height |
| 88 | | // var count:int = Math.floor( unscaledHeight / (textHeight*1.5) ); // determine number of labels |
| 89 | | // var mark:int = 0x01; |
| 90 | | // if(count <= 3) mark = 0x02; |
| 91 | | // else if (count <= 5) mark = 0x04; |
| 92 | | // else if (count <= 9) mark = 0x08; |
| 93 | | // else if (count <= 12) mark = 0x10; |
| 94 | | // else /*if (count <= 24)*/ mark = 0x20; |
| 95 | | // |
| 96 | | // var item:Object; |
| 97 | | // var inBorderThicknesses:Array = getStyle_("innerBorderThicknesses", [ 1 ]); |
| 98 | | // var ystep:Number = (unscaledHeight - (2*outerBorderThickness_+2*verticalMargin_) - (23*inBorderThicknesses[0])) / 24; |
| 99 | | // var y:Number = outerBorderThickness_+verticalMargin_; |
| 100 | | // //graphics.lineStyle(1, 0x0000ff, 0.7, true); // debug |
| 101 | | // for (var row:int = 0; row <=24; row++ ){ |
| 102 | | // //graphics.drawRoundRect(0, y - (textHeight*0.66), leftHorizontalMargin_, Math.min( Math.floor( ystep ), textHeight), 0, 0);// debug |
| 103 | | // |
| 104 | | // item = hourLabels.getValueAt(row); |
| 105 | | // item.element.visible = item.element.includeInLayout = true;//(item.score & mark) > 0; |
| 106 | | // item.element.x = 0; |
| 107 | | // item.element.y = Math.floor( y - (textHeight*0.66) ); |
| 108 | | // item.element.width = leftHorizontalMargin_; |
| 109 | | // item.element.height = Math.min( Math.floor( ystep ), textHeight); |
| 110 | | // |
| 111 | | // y += (ystep + inBorderThicknesses[0]); |
| 112 | | // } |
| 113 | | // |
| 114 | | // } |
| 115 | | |
| | 45 | if(visible){ // repaint only if visible |
| | 46 | // call first in order to get grid drawn correctly |
| | 47 | super.updateDisplayList(unscaledWidth, unscaledHeight); |
| | 48 | } |
| 175 | | var timeBegin:int = ((data.from.getMinutes() as int)/15); |
| 176 | | var timeWidth:int = data.to.getHours() - data.from.getHours() + 1; |
| 177 | | timeWidth *= 4; |
| 178 | | timeWidth -= ( timeBegin + (4 -((data.to.getMinutes() as int)/15)) ); |
| 179 | | |
| 180 | | ev.height = stepY * timeWidth; |
| | 105 | // if event exceed current day |
| | 106 | var from:DateUtil = (new DateUtil(data.from)).dayBegin(); |
| | 107 | var current:DateUtil = (new DateUtil(currentDay)).dayBegin(); |
| | 108 | var to:DateUtil = (new DateUtil(data.to)).dayBegin(); |
| | 109 | |
| | 110 | if( current.compare(from) > 0 ){ |
| | 111 | timeBegin = 0; |
| | 112 | } |
| | 113 | if( current.compare(to) < 0 ){ |
| | 114 | timeEnd = rowsPosition[1].length - 1; |
| | 115 | } |
| | 116 | |