isackrubio / gwt-cal

Automatically exported from code.google.com/p/gwt-cal
0 stars 0 forks source link

calender calculates timeblockclick event getTarget date value #67

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. not using absolute position on calendar
2.
3.

What is the expected output? What do you see instead?
i get wrong values depending on the changes to size and position of the 
calendar widget

What version of the product are you using? On what operating system?
9.1

Please provide any additional information below.

i have a solution  replace dayClicked() in MonthView class line 434

    public int getRelativeX(Element target,Event e) {

        return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
          target.getOwnerDocument().getScrollLeft();
      }

      /**
       * Gets the mouse y-position relative to a given element.
       * 
       * @param target the element whose coordinate system is to be used
       * @return the relative y-position
       */
      public int getRelativeY(Element target,Event e) {

        return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
          target.getOwnerDocument().getScrollTop();
      }

    private void dayClicked(Event event) {

        int x = getRelativeX(appointmentCanvas.getElement(), event);
        int y = getRelativeY(appointmentCanvas.getElement(), event);

        int row = (int) Math.floor(y / (appointmentCanvas.getOffsetHeight() / monthViewRequiredRows));
        int col = (int) Math.floor(x / (appointmentCanvas.getOffsetWidth() / DAYS_IN_A_WEEK));
        calendarWidget.fireTimeBlockClickEvent(
            cellDate(row * DAYS_IN_A_WEEK + col));
    }

Original issue reported on code.google.com by fenster....@gmail.com on 16 Jul 2010 at 11:21

GoogleCodeExporter commented 9 years ago

Original comment by Brad.Ryd...@gmail.com on 19 Jul 2010 at 5:07

GoogleCodeExporter commented 9 years ago
issue #134 doublon ?

Original comment by dom....@gmail.com on 10 Sep 2012 at 1:29