Jump to content


Draggable Poll: Property Name Change?

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Draggable Property Name Change?  

8 members have voted

  1. 1. Should xMax, xMin, yMax, and yMin be changed to maxX, minX, maxY, and minY?

    • Yes
    • No

Recommended Posts

The next update to Draggable introduces some useful new properties:

  • pointerX
  • pointerY
  • endX
  • endY

The "pointer" properties refer to the mouse (or touch) location from the last event (like event.pageX) associated with that Draggable instance. 


The "end" properties refer to where the element will land. Those get populated as soon as the user releases the mouse (or touch).


Draggable also has the following properties (which aren't new):

  • x
  • y
  • xMax
  • xMin
  • yMax
  • yMin

Here's the dilemma: technically there's an inconsistency with the way the new names are structured compared to the existing properties - "x" and "y" are at the end instead of the beginning ("endX" vs. "xMax"). Matching the current naming structure seems awkward ("xPointer" and "yPointer" don't seem nearly as intuitive as "pointerX" and "pointerY"). I don't like having inconsistencies, though.


Should we change the max/min names so that the "x" and "y" are at the end? The only awkward one is "maxX" because there are two x's at the end. So it'd mean changing them to "maxX", "minX", "maxY", and "minY". 


Or we could leave the old/existing properties the same and live with the inconsistency. The nice thing about this is it wouldn't break any existing code that users have written. However, since Draggable is so new, this isn't as big of an issue - if we're going to make a change to the API, it's much better to do it now before more people start using it.


What are your thoughts? We need to make this decision quickly, as the goal is to release the Draggable update by tomorrow. Your input is greatly appreciated.


(by the way, the upcoming new features are mentioned in this thread: http://forums.greensock.com/topic/8056-draggable-invert-bounds-behavior/#entry31763)

Link to comment
Share on other sites


IMHO is better the current syntax, in the particular case of maxX (and I'm just pointing at this one) having the same letter twice could become an issue, but it's only the final letter and as always is camel case. On the other hand there's the inconsistency issue, if you check the posts of people embracing the JS library coming from AS, one of the things they always are grateful for is the engine's consistency through different platforms.

One of the best things of GSAP is it's consistency, if you check TweenMax(), Draggable(), ThrowPropsPlugin(), SplitText() and certainly the ones that'll come in the future, they all work the same way and that's a great added value because it makes more intuitive working with the toolset.

In this one I'm all for consistency.

Just my two cents

  • Like 2
Link to comment
Share on other sites

My two cents: update the names to keep things consistent now, while the user base is still small.


The biggest problem I see is getting people to read the API, so keeping that consistent and easier to remember would be very useful.


Perhaps a sticky announcement could (hopefully) be enough to quickly catch the few users who come here with 'broken' code.

  • Like 2
Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.