Skip to main content

Search and Top Navigation

#12588 new feature ()

Opened May 13, 2015 04:00AM UTC

Last modified May 13, 2015 05:05PM UTC

Draggable: add an ability to use function in the `pointAt` option

Reported by: extempl Owned by: extempl
Priority: minor Milestone: none
Component: ui.draggable Version: 1.11.4
Keywords: Cc:
Blocked by: Blocking:
Description

The reason is that offset may depend on different blocks or media rules (one block has different sizes on tablet and desktop).

Attachments (0)
Change History (4)

Changed May 13, 2015 04:32AM UTC by extempl comment:1

Just add following code to draggable.js:388

if ($.isFunction(obj)) {		
	obj = obj.call( this.element[ 0 ] );
 }

Changed May 13, 2015 12:22PM UTC by scottgonzalez comment:2

owner: → extempl
status: newpending

And why does that need to be determined at start instead of at initialization? The page isn't changing from tablet to desktop over time.

Changed May 13, 2015 12:27PM UTC by scottgonzalez comment:3

Also, there is no pointAt option. I believe you meant cursorAt.

Changed May 13, 2015 05:05PM UTC by extempl comment:4

status: pendingnew
And why does that need to be determined at start instead of at initialization?

In my case, there are a lot of draggables (≈2000) which has different sizes, but user will drag only ≈100 through entire session.

So why it should be calculated and checked on every initialisation instead of simple check at start?

The page isn't changing from tablet to desktop over time.

Well, I know people, who uses windowed browser and resizing it from time to time. Also, tablet/mobile rotation changes size too.

Also, there may be some dynamic size where you may need to point cursor at center of an element.

In any way, the best approach is to let to user decide what will be better for him - calculate size on initialisation or on drag start.

Also, there is no pointAt option. I believe you meant cursorAt.

Yes, you're right. My fault here.