Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    eventSnapGap in workflow calendars

    Hello,

    when we start with SmartGWT (Version 3.1) the eventSnapGap was defined in minutes. When we want that the event snaps every 15 minutes, we have to set the eventSnapGap to 15.

    Now in Version 5.0, the definition of the eventSnapGap has changed. Now it is the count of pixels. When we want that the event snaps every 15 minutes, we have to set the eventSnapGap to rowHeight/2.

    But, when we use the scrollToWorkday feature, the rowHeight is compute when drawing the calendar and we can't set the eventSnapGap to "15 minutes".

    At the moment the eventSnapGap have to be equal to the rowHeight. Other settings produce starnge snaps.

    How can we set the snap to "15 minutes" when using the scrollToWorkday feature?

    Regards

    Peter

    #2
    eventSnapGap has always been a pixel value - it's possible that at some time in the past there was a default rowHeight of 30px, rather than the existing default of 20px, or that you'd set your rowHeights to 30px yourself - either would have given the impression of a minute-based eventSnapGap - but it's always been a pixel value.

    There is no current provision or override-point for automatically adjusting the eventSnapGap at runtime, according to the calculated height of rows when showWorkday is set.

    We can look into what's required to support this and implementing it would likely be a valid Feature Sponsorship.

    Comment


      #3
      Hello,

      I have test it with Version v8.3p_2014-11-26/Pro Deployment (2014-11-26) and it works fine.

      final Calendar calendar = new Calendar();
      calendar.setDataSource(eventDS);
      calendar.setAutoFetchData(true);
      calendar.setFirstDayOfWeek(1);
      calendar.setShowWorkday(true);
      calendar.setScrollToWorkday(true);
      calendar.setRowHeight(10);
      calendar.setEventSnapGap(15);

      The event snaps every 15 minutes.

      It isn't a new feature, when it works in that version.

      Peter

      Comment


        #4
        You're right, eventSnapGap has been a pixel value for several versions, but it was a minute value in 3.1.

        We're looking into it.

        Comment


          #5
          This has been addressed for builds dated December 18 and later.

          Comment


            #6
            I have tested it now with Version v10.0p_2014-12-18/Pro Deployment (2014-12-18) and get some more errors.

            1. The drag of an event get an undefined function error in function getSnapGapPixels.
            Change in ISC_Calendar.js:

            Code:
                    dragRepositionMove : function () {
                        var canvas = this.eventCanvas,
                            props = canvas._dragProps,
                            event = canvas.event,
                            cal = canvas.calendar,
                           eventSnapPixels = cal.getSnapGapPixels(this),
                            view = this.view,
                             isTL = view.isTimelineView(),
                            gr = view.body,
                            lanePadding = this.getEventPadding(),
                            // IndicatorCanvas sets this value in positionToEventCanvas
                            fixedTop = props._fixedTop != null ? props._fixedTop : -1,
                            fixedLeft = -1,
                            fixedWidth = -1,
                            fixedHeight = -1
                        ;
            to

            Code:
                    dragRepositionMove : function () {
                        var canvas = this.eventCanvas,
                            props = canvas._dragProps,
                            event = canvas.event,
                            cal = canvas.calendar,
                            view = this.view,
                            eventSnapPixels = cal.getSnapGapPixels(view),
                            isTL = view.isTimelineView(),
                            gr = view.body,
                            lanePadding = this.getEventPadding(),
                            // IndicatorCanvas sets this value in positionToEventCanvas
                            fixedTop = props._fixedTop != null ? props._fixedTop : -1,
                            fixedLeft = -1,
                            fixedWidth = -1,
                            fixedHeight = -1
                        ;
            helps, because this is a "isc_Calendar_0_weekView_eventDragTarget".

            2. When dragging the event to a new time, the event starts at 12:29am not at 12:30am.


            Peter

            Comment


              #7
              We fixed the JS error - you can retest in tomorrow's build.

              But we don't see the issue of snapDates being off by a minute - what is the rowHeight at this time?

              Comment


                #8
                Tank's.

                It may be a rounding error. The rowHeight was 31.

                So in getDateFromPoint() snapGapMins is 14.51....

                Peter

                Comment

                Working...
                X