~renatofilho/ubuntu-calendar-app/new-view-canvas

« back to all changes in this revision

Viewing changes to WeekView.qml

  • Committer: Renato Araujo Oliveira Filho
  • Date: 2016-10-03 19:02:11 UTC
  • Revision ID: renato.filho@canonical.com-20161003190211-oe09jyi6rpdx1eni
Keep calendar view anchored correct based on current visible item.

Show diffs side-by-side

added added

removed removed

Lines of Context:
154
154
        }
155
155
 
156
156
        delegate: CCanvas.CalendarGrid {
 
157
            readonly property int indexTypeValue: weekViewPath.indexType(index)
157
158
            property var dateIndex: anchorFirstDayOfWeek.addDays((weekViewPath.loopCurrentIndex + weekViewPath.indexType(index)) * 7)
158
159
 
159
160
            width: weekViewPath.width
160
161
            height: weekViewPath.height
 
162
            yAnchor: PathView.isCurrentItem ? -1 : weekViewPath.currentItem.contentY
161
163
            model: OrganizerModel {
162
164
                manager: "eds"
163
165
                startPeriod: dateIndex.midnight()
166
168
            }
167
169
 
168
170
            delegate: CCanvas.EventDelegate {}
 
171
 
 
172
            // keep view horizontl align correct to scroll btw pages
 
173
            onIndexTypeValueChanged: {
 
174
                if (indexTypeValue < 0)
 
175
                    align = alignRight
 
176
                else if (indexTypeValue > 0)
 
177
                    align = alignLeft
 
178
            }
169
179
        }
170
180
    }
171
181