Skip to content
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.

Commit

Permalink
Moved redraw() method to API again... had to compromise since stickin…
Browse files Browse the repository at this point in the history
…g it in reposition() would cause some pretty nasty drawbacks when using mouse positioning. Might rethink this later.
  • Loading branch information
Craga89 committed Dec 6, 2010
1 parent b6257e3 commit a2b65bb
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 133 deletions.
2 changes: 1 addition & 1 deletion dist/jquery.qtip.css
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Thu Dec 2 01:10:40 2010 +0000
* Date: Mon Dec 6 02:06:41 2010 +0000
*/

.ui-tooltip-accessible{
Expand Down
64 changes: 30 additions & 34 deletions dist/jquery.qtip.js
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Thu Dec 2 01:10:40 2010 +0000
* Date: Mon Dec 6 02:06:41 2010 +0000
*/

"use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
Expand Down Expand Up @@ -225,34 +225,6 @@ function QTip(target, options, id)
return returned;
}

// IE max/min height/width function
function redraw()
{
// Make sure tooltip is rendered and the browser needs the redraw
if(!self.rendered || !$.fn.qtip.redraw) { return FALSE; }

var tooltip = self.elements.tooltip,
style = tooltip.attr('style'),
dimensions;

// Determine actual dimensions using our calculate function
tooltip.css({ width: 'auto', height: 'auto' });
dimensions = calculate('dimensions');

// Determine actual width
$.each(['width', 'height'], function(i, prop) {
// Parse our max/min properties
var max = parseInt(tooltip.css('max-'+prop), 10) || 0,
min = parseInt(tooltip.css('min-'+prop), 10) || 0;

// Determine new dimension size based on max/min/current values
dimensions[prop] = max + min ? Math.min( Math.max( dimensions[prop], min ), max ) : dimensions[prop];
});

// Set the newly calculated dimensions
tooltip.css(dimensions);
}

function removeTitle()
{
var elems = self.elements;
Expand Down Expand Up @@ -401,6 +373,7 @@ function QTip(target, options, id)

// If queue is empty, update tooltip and continue the queue
if(images.length === 0) {
self.redraw();
if(self.rendered === TRUE) {
self.reposition(self.cache.event);
}
Expand Down Expand Up @@ -1079,9 +1052,6 @@ function QTip(target, options, id)
scrollTop: viewport.scrollTop()
};

// Update tooltip dimensions if needed
redraw();

// Check if mouse was the target
if(target === 'mouse') {
// Force left top to allow flipping
Expand Down Expand Up @@ -1143,7 +1113,6 @@ function QTip(target, options, id)
position.left += posOptions.adjust.x + (my.x === 'right' ? -elemWidth : my.x === 'center' ? -elemWidth / 2 : 0);
position.top += posOptions.adjust.y + (my.y === 'bottom' ? -elemHeight : my.y === 'center' ? -elemHeight / 2 : 0);


// Calculate collision offset values
if(posOptions.adjust.screen && target[0] !== window && target[0] !== document.body) {
position.adjusted = { left: adjust.left(position.left), top: adjust.top(position.top) };
Expand Down Expand Up @@ -1182,6 +1151,34 @@ function QTip(target, options, id)
return self;
},

// IE max/min height/width simulartor function
redraw: function()
{
// Make sure tooltip is rendered and the browser needs the redraw
if(!self.rendered || !($.browser.msie && parseInt($.browser.version.charAt(0), 10) < 9)) { return FALSE; }

var tooltip = self.elements.tooltip,
style = tooltip.attr('style'),
dimensions;

// Determine actual dimensions using our calculate function
tooltip.css({ width: 'auto', height: 'auto' });
dimensions = calculate('dimensions');

// Determine actual width
$.each(['width', 'height'], function(i, prop) {
// Parse our max/min properties
var max = parseInt(tooltip.css('max-'+prop), 10) || 0,
min = parseInt(tooltip.css('min-'+prop), 10) || 0;

// Determine new dimension size based on max/min/current values
dimensions[prop] = max + min ? Math.min( Math.max( dimensions[prop], min ), max ) : dimensions[prop];
});

// Set the newly calculated dimensions
tooltip.css(dimensions);
},

disable: function(state)
{
var tooltip = self.elements.tooltip;
Expand Down Expand Up @@ -1499,7 +1496,6 @@ $(document).bind('mousemove.qtip', function(event) {
$.fn.qtip.nextid = 0;
$.fn.qtip.inactiveEvents = 'click dblclick mousedown mouseup mousemove mouseleave mouseenter'.split(' ');
$.fn.qtip.zindex = 15000;
$.fn.qtip.redraw = $.browser.msie && parseInt($.browser.version.charAt(0), 10) < 9;

// Setup base plugins
$.fn.qtip.plugins = {
Expand Down

0 comments on commit a2b65bb

Please sign in to comment.