Fix bug 535353 - When event start time=12:10 is dragged to start time=full hour then it is released at full hour +10min. r=Mozilla
authorDecathlon <bv1578@gmail.com>
Fri, 28 May 2010 08:06:00 +0200
changeset 5901 850307f86b28935754c9a1e05f81703193e67fd9
parent 5900 847ae9faa0cbe20fc550909ab103da7a0b1c9022
child 5902 a63c725f626d50696ef0e063a0ad479004235a26
push idunknown
push userunknown
push dateunknown
reviewersMozilla
bugs535353
Fix bug 535353 - When event start time=12:10 is dragged to start time=full hour then it is released at full hour +10min. r=Mozilla
calendar/base/content/calendar-multiday-view.xml
--- a/calendar/base/content/calendar-multiday-view.xml
+++ b/calendar/base/content/calendar-multiday-view.xml
@@ -1280,17 +1280,17 @@
           let lastShadow = (aShadows != null ? aShadows : this.mDragState.shadows);
           while (lastCol.nextSibling && lastIndex < lastShadow - 1) {
               lastCol = lastCol.nextSibling;
               lastIndex++;
           }
 
           // returns first and last column with shadows that are visible in the
           // week and the positions of these (visible) columns in the set of
-          // columns shadows of the occurence
+          // columns shadows of the occurrence
           return { firstCol:    firstCol,
                    firstIndex:  firstIndex,
                    lastCol:     lastCol,
                    lastIndex:   lastIndex };
         ]]></body>
       </method>
 
       <method name="updateShadowsBoxes">
@@ -1597,19 +1597,20 @@
           if (dragState.dragType == "modify-end" ||
               dragState.dragType == "new") {
               newEnd.resetTo(dragDay.year, dragDay.month, dragDay.day,
                              0, dragState.lastEnd + col.mStartMin, 0,
                              newEnd.timezone);
           }
 
           if (dragState.dragType == "move") {
-              // Figure out how much the event moved.
+              // Figure out how much the event moved to take the same position
+              // of the shadow (snap to full 15 minutes and multiples).
               let duration = dragDay.subtractDate(dragState.origDate);
-              let minutes = dragState.lastStart - dragState.origMinStart;
+              let minutes = dragState.lastStart - dragState.realStart;
 
               // Since both boxDate and beginMove are dates (note datetimes),
               // subtractDate will only give us a non-zero number of hours on
               // DST changes. While strictly speaking, subtractDate's behavior
               // is correct, we need to move the event a discrete number of
               // days here. There is no need for normalization here, since
               // addDuration does the job for us. Also note, the duration used
               // here is only used to move over multiple days. Moving on the
@@ -1772,16 +1773,17 @@
 
               // in a move, origMin will be the min of the start element;
               // but we also use the min of start and end separately because
               // we keep track of both to figure out the real shadow size.
               // We snap to the start and add the real duration to find the end
               this.mDragState.origMin = Math.floor(mins.start/15) * 15;
               this.mDragState.origMinStart = Math.floor(mins.realStart/15) * 15;
               this.mDragState.origMinEnd = this.mDragState.limitDurationMin + this.mDragState.origMinStart;
+              this.mDragState.realStart = mins.realStart;
               let shadowElements = this.getShadowElements(this.mDragState.origMinStart,
                                                           this.mDragState.origMinEnd);
               this.mDragState.shadows = shadowElements.shadows;
               this.mDragState.offset = shadowElements.offset;
               // Because we can pass this event to other columns, we also need
               // to track the original column's date too, to get the correct offset
               this.mDragState.origDate = this.mDate;
               // we need to set a mouse offset, since we're not dragging from