@forcecalendar/interface 1.0.38 → 1.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forcecalendar/interface",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "type": "module",
5
5
  "description": "Official interface layer for forceCalendar Core - Enterprise calendar components",
6
6
  "main": "dist/force-calendar-interface.umd.js",
@@ -180,14 +180,15 @@ export class DayViewRenderer extends BaseViewRenderer {
180
180
  if (e.target.closest('.fc-event')) return;
181
181
 
182
182
  const date = new Date(dayEl.dataset.date);
183
- const rect = dayEl.getBoundingClientRect();
184
183
  const scrollContainer = this.container.querySelector('#day-scroll-container');
185
- const y = e.clientY - rect.top;
184
+ const gridTop = dayEl.offsetTop;
185
+ const y = e.clientY - dayEl.getBoundingClientRect().top + (scrollContainer ? scrollContainer.scrollTop : 0) - gridTop;
186
186
 
187
- // Calculate time from click position
187
+ // Calculate time from click position within the 1440px time grid
188
+ const clampedY = Math.max(0, Math.min(y + gridTop, this.totalHeight));
188
189
  date.setHours(
189
- Math.floor(y / this.hourHeight),
190
- Math.floor((y % this.hourHeight) / (this.hourHeight / 60)),
190
+ Math.floor(clampedY / this.hourHeight),
191
+ Math.floor((clampedY % this.hourHeight) / (this.hourHeight / 60)),
191
192
  0,
192
193
  0
193
194
  );
@@ -159,14 +159,15 @@ export class WeekViewRenderer extends BaseViewRenderer {
159
159
  if (e.target.closest('.fc-event')) return;
160
160
 
161
161
  const date = new Date(dayEl.dataset.date);
162
- const rect = dayEl.getBoundingClientRect();
163
162
  const scrollContainer = this.container.querySelector('#week-scroll-container');
164
- const y = e.clientY - rect.top;
163
+ const gridTop = dayEl.offsetTop;
164
+ const y = e.clientY - dayEl.getBoundingClientRect().top + (scrollContainer ? scrollContainer.scrollTop : 0) - gridTop;
165
165
 
166
- // Calculate time from click position
166
+ // Calculate time from click position within the 1440px time grid
167
+ const clampedY = Math.max(0, Math.min(y + gridTop, this.totalHeight));
167
168
  date.setHours(
168
- Math.floor(y / this.hourHeight),
169
- Math.floor((y % this.hourHeight) / (this.hourHeight / 60)),
169
+ Math.floor(clampedY / this.hourHeight),
170
+ Math.floor((clampedY % this.hourHeight) / (this.hourHeight / 60)),
170
171
  0,
171
172
  0
172
173
  );