Opened 8 years ago

Last modified 8 years ago

#12588 new feature

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).

Change History (4)

comment:1 Changed 8 years ago by extempl

Just add following code to draggable.js:388

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

comment:2 Changed 8 years ago by Scott González

Owner: set to 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.

comment:3 Changed 8 years ago by Scott González

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

comment:4 Changed 8 years ago by extempl

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.

Note: See TracTickets for help on using tickets.