test/lib/draggable.js
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/**
* Simple draggable tool, just for demo or testing.
* Use jquery.
*/
(function (global) {
var BORDER_WIDTH = 4;
var $ = global.jQuery;
global.draggable = {
/**
* @param {HTMLElement} mainEl
* @param {module:echarts/echarts~EChart} chart
* @param {Object} [opt] {width: ..., height: ...}
* @param {number} [opt.width] If not specified, use mainEl current width.
* @param {number} [opt.height] If not specified, use mainEl current height.
* @param {boolean} [opt.lockX=false]
* @param {boolean} [opt.lockY=false]
* @param {number} [opt.throttle=false]
* @return {type} description
*/
init: function (mainEl, chart, opt) {
opt = opt || {};
var chartResize = chart ? $.proxy(chart.resize, chart) : function () {};
if (opt.throttle) {
chartResize = throttle(chartResize, opt.throttle, true, false);
}
var mainEl = $(mainEl);
$('.draggable-control').remove();
var controlEl = $(
'<div class="draggable-control">DRAG<span class="draggable-label"></span></div>'
);
controlEl.css({
'position': 'absolute',
'border-radius': '30px',
'width': '60px',
'height': '60px',
'line-height': '60px',
'text-align': 'center',
'background': '#333',
'color': '#fff',
'cursor': 'pointer',
'font-size': '18px',
'box-shadow': '0 0 5px #333',
'-webkit-user-select': 'none',
'user-select': 'none'
});
var label = controlEl.find('.draggable-label');
label.css({
'display': 'block',
'position': 'absolute',
'color': '#000',
后面还有 166 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
