event callback afterMove

Page: 1

Author Post
Member
Registered: Feb 2013
Posts: 30
Dear Admin,
i've implemented a window manager with multi fb instances. everything works fine, thanks to that great library.
those windows get stored in a session and so 'reconstructed' after a user reloads a page.
the only event i can't catch by fb-default functions is the 'on move' event of a floatbox - i mean to get a callback when the user moved one of the boxes, like happens with afterResize.

                        fb.start(content, {
type: 'ajax',
contentScroll: true,
boxScroll: false,
enableDragResize: true,
enableDragMove: true,
modal: false,
caption: caption,
instanceName: msg.partner.instance[key],
boxLeft: msg.partner.win_left[key],
boxTop: msg.partner.win_top[key],
width: msg.partner.win_width[key],
height: msg.partner.win_height[key],
minBoxWidth: BOX_WIDTH_MSG,
minBoxHeight: BOX_HEIGHT_MSG,
minContentWidth: BOX_WIDTH_MSG,
minContentHeight: BOX_HEIGHT_MSG,
afterResize: function(){msg.win_resize(key);},
afterItemEnd: function(){msg.win_end(key);},
afterItemStart: function(){...


my only idea is to append a js-event to the drag wrapper after fb-instance got inserted into DOM - any better ideas or suggestions?

thanks and best regards,
wolfgang
Administrator
Registered: Aug 2008
Posts: 3382
Do you really need to capture state every time the box is moved or resized? Wouldn't it be enough to know its position at the time its state is stored? If so, the fb.getLayout function would be helpful because it returns screen (not document) coordinates that the boxLeft and boxTop options use.

Off the top of my head, it could look something like:
var instance = fb.getInstance( 'instanceName' ),
boxPos = fb.getLayout( instance.fbBox ),
contentPos = fb.getLayout( instance.fbContent );
return {
boxLeft: boxPos.left,
boxTop: boxPos.top,
width: contentPos.width,
height: contentPos.height
};


I think you're already capturing state if someone closes the box by hooking beforeBoxEnd. You could capture state on page navigation by hooking window.unload.
« Last edit by admin on Fri Jun 06, 2014 7:47 am. »
Member
Registered: Feb 2013
Posts: 30
thanks for your quick and competent reply!

Page: 1