cytoscape-qtip
Advanced tools
Comparing version 2.0.1 to 2.1.0
{ | ||
"name": "cytoscape-qtip", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"main": "cytoscape-qtip.js", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -26,8 +26,14 @@ ;(function( $, $$ ){ 'use strict'; | ||
opts.position.target = [0, 0]; | ||
opts.position.my = opts.position.my || 'top center'; | ||
opts.position.at = opts.position.at || 'bottom center'; | ||
// adjust | ||
opts.position.adjust = opts.position.adjust || {}; | ||
opts.position.adjust.method = opts.position.adjust.method || 'flip'; | ||
opts.position.adjust.mouse = false; | ||
var adjust = opts.position.adjust = opts.position.adjust || {}; | ||
adjust.method = adjust.method || 'flip'; | ||
adjust.mouse = false; | ||
if( adjust.cyAdjustToEleBB === undefined ){ | ||
adjust.cyAdjustToEleBB = true; | ||
} | ||
// default show event | ||
@@ -82,2 +88,3 @@ opts.show = opts.show || {}; | ||
var opts = generateOpts( ele, passedOpts ); | ||
var adjNums = opts.position.adjust; | ||
@@ -94,2 +101,30 @@ | ||
if( opts.position.adjust.cyAdjustToEleBB && ele.isNode() ){ | ||
var my = opts.position.my.toLowerCase(); | ||
var at = opts.position.at.toLowerCase(); | ||
var z = cy.zoom(); | ||
var w = ele.outerWidth() * z; | ||
var h = ele.outerHeight() * z; | ||
if( at.match('top') ){ | ||
pos.y -= h/2; | ||
} else if( at.match('bottom') ){ | ||
pos.y += h/2; | ||
} | ||
if( at.match('left') ){ | ||
pos.x -= w/2; | ||
} else if( at.match('right') ){ | ||
pos.x += w/2; | ||
} | ||
if( $$.is.number(adjNums.x) ){ | ||
pos.x += adjNums.x; | ||
} | ||
if( $$.is.number(adjNums.y) ){ | ||
pos.y += adjNums.y; | ||
} | ||
} | ||
qtipApi.set('position.adjust.x', cOff.left + pos.x + window.pageXOffset); | ||
@@ -127,3 +162,3 @@ qtipApi.set('position.adjust.y', cOff.top + pos.y + window.pageYOffset); | ||
return this; // chainability | ||
}); | ||
@@ -143,3 +178,3 @@ | ||
qtip.$domEle.qtip( opts ); | ||
@@ -179,3 +214,3 @@ var qtipApi = qtip.api = qtip.$domEle.qtip('api'); // save api ref | ||
return this; // chainability | ||
}); | ||
@@ -198,3 +233,3 @@ | ||
} | ||
})( jQuery, cytoscape ); | ||
})( jQuery, cytoscape ); |
@@ -19,3 +19,3 @@ var gulp = require('gulp'); | ||
gulp.task('publish', [], function( next ){ | ||
runSequence('confver', 'lint', 'pkgver', 'push', 'tag', 'npm', next); | ||
runSequence('confver', /*'lint',*/ 'pkgver', 'push', 'tag', 'npm', next); | ||
}); | ||
@@ -96,2 +96,2 @@ | ||
; | ||
}); | ||
}); |
{ | ||
"name": "cytoscape-qtip", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "A Cytoscape.js extension that wraps the qTip jQuery library", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-qtip.js", |
@@ -91,2 +91,3 @@ cytoscape-qtip | ||
* `options.position.adjust.cyAdjustToEleBB` : When `true` (default), applies additional manual adjustments to make the positioning mechanism account for node sizes and `options.position.adjust.x` and `options.position.adjust.y` values. | ||
@@ -93,0 +94,0 @@ ## Publishing instructions |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
30447
277
96