📄 timeline.js
字号:
width:'1px'
},
BIGLABEL:{
'z-index':3,
height:'16px',
'background-color':'#C8E2FC',
cursor:'move',
'border-bottom':'solid 1px #7BA3CB'
},
SMALLLABEL:{
'z-index':4,
height:'14px',
'background-color':'#C8E2FC',
cursor:'move',
'border-bottom':'solid 1px #648CB4'
},
ITEMS:{
position:'relative',
background: linb.UI.$bg('bars.gif',' left top')
},
'BIGLABEL div, SMALLLABEL div':{
'border-left':'solid 1px #7BA3CB',
'text-align':'center',
position:'absolute',
cursor:'move',
"-moz-user-select":linb.browser.gek?'none':'',
top:0,
overflow:'visible',
height:'100%'
},
'BIGLABEL div':{
$order:2,
'text-align':'left',
'padding-left':'4px'
},
TIPS:{
position:'relative',
height:'14px',
'font-size':'12px',
'line-height':'14px',
'text-align':'center'
},
ACTIVE:{
'z-index':300,
position:'relative',
'border-left': '1px dashed',
'border-right': '1px dashed',
left:'-100px',
width:'0',
background:0,
height:'100%'
},
'ZOOMIN, ZOOMOUT, DATE, PRE, NEXT, MIN':{
background: linb.UI.$bg('icons.gif', 'no-repeat', true)
},
ZOOMIN:{
$order:1,
'background-position':'-360px -70px'
},
'ZOOMIN-mouseover':{
$order:2,
'background-position': '-360px -90px'
},
'ZOOMIN-mousedown':{
$order:3,
'background-position': '-360px -110px'
},
ZOOMOUT:{
$order:1,
'background-position':'-380px -70px'
},
'ZOOMOUT-mouseover':{
$order:2,
'background-position': '-380px -90px'
},
'ZOOMOUT-mousedown':{
$order:3,
'background-position': '-380px -110px'
},
DATE:{
$order:1,
'background-position':'-340px -70px'
},
'DATE-mouseover':{
$order:2,
'background-position':' -340px -90px'
},
'DATE-mousedown':{
$order:3,
'background-position':' -340px -110px'
},
PRE:{
$order:1,
'background-position':'-260px -70px',
top:'0'
},
'PRE-mouseover':{
$order:2,
'background-position': '-260px -90px'
},
'PRE-mousedown':{
$order:3,
'background-position': '-260px -110px'
},
NEXT:{
$order:1,
position:'absolute',
'background-position':'-280px -70px',
top:'0'
},
'NEXT-mouseover':{
$order:2,
'background-position': '-280px -90px'
},
'NEXT-mousedown':{
$order:3,
'background-position': '-280px -110px'
},
ITEM:{
position:'absolute',
overflow:'visible'
},
'MIN, NORMAL':{
//position:'absolute',
//top:0,
//left:0,
position:'relative',
height:'16px',
overflow:'hidden',
'z-index':'1'
},
MIN:{
width:'16px',
'background-position':'-320px -70px',
cursor:'pointer'
},
'MIN-mouseover':{
'background-position': '-320px -90px'
},
'MIN-mousedown':{
'background-position': '-320px -110px'
},
NORMAL:{
cursor:'pointer',
'background-color': '#B3D7FB',
border:'solid 1px #648CB4'
},
'NORMAL-mouseover':{
$order:2,
'border-color': 'red'
},
'LEFT, HEAD, RIGHT':{
position:'absolute',
top:0,
height:'100%'
},
HEAD:{
background: linb.UI.$bg('handler.gif', ' left top', true),
width:'6px',
left:'3px',
cursor:'move',
'z-index':5
},
'LEFT, RIGHT':{
width:'2px',
'z-index':10
},
'LEFT':{
cursor:'e-resize',
left:0
},
'RIGHT':{
cursor:'w-resize',
right:0
},
CON:{
'padding-left':'12px',
position:'relative',
height:'100%',
overflow:'hidden'
}
},
RenderTrigger:function(){
var self=this, p=self.properties,cls=self.box;
self.$active = self.getSubNode('ACTIVE').get(0);
cls._ajustHeight(self);
self.boxing().iniContent();
},
_onDropMarkShow:function(){linb.DragDrop.setDragIcon('add');return false},
_onDropMarkClear:function(){linb.DragDrop.setDragIcon();return false},
_onDragEnter:function(profile,e,src){
var t=profile.properties,
ep=linb.Event.getPos(e),
_left = t._unitPixs/2
;
linb(profile.$active).css('display','block');
profile.$dd_ox =linb([src]).offset().left+_left;
profile.$$ondrag=true;
},
_onDragLeave:function(profile){
profile.$$ondrag=profile.$dd_ox=null;
profile.box._deActive(profile);
},
_onDrop:function(profile){
profile.$$ondrag=profile.$dd_ox=null;
var r = profile.box._deActive(profile),
task={id:_.id(),caption:profile.properties.dftTaskName},
box=profile.box,
b=profile.boxing();
task.from = box._getTime(profile, r.left);
task.to = box._getTime(profile, r.left+r.width);
task._dropData=linb.DragDrop.getProfile().dragData;
if(profile.beforeNewTasks && false===b.beforeNewTasks(profile, [task])){}else
b.addTasks([task]);
},
_prepareData:function(profile){
var p=profile.properties,
d={},
date=linb.Date,
us=date.$TIMEUNIT,
nodisplay='display:none',
zoom=profile.box.$zoom,
m=0,u,
i,t,label,temp,_date,width,rate,
_unitParas,
_dateStart,
_barCount,_leftBarCount,_rightBarCount,_barCountall,
smallMarks,smallLabelStart,smallLabelEnd,smallLabelUnit,smallLabelCount,smallLabelFormat
;
d.dateDisplay = p.dateBtn?'':nodisplay;
d.closeDisplay = p.closeBtn?'':nodisplay;
d.optDisplay = p.optBtn?'':nodisplay;
d._showBigLabel=p.showBigLabel?'':nodisplay;
// for quick move
p._scroll_offset = p._scrollRate;
p._lines=[{}];
//border
d._bWidth = p.width - 2*p.$borderW;
d._bHeight = p.height - 2*p.$borderW;
//view
p._viewHeight = d._bHeight;
d._tipsdisplay=p.showTips?'':nodisplay;
d._bardisplay = p.showBar?'':nodisplay;
//get unitparas from timespan key
if(p.timeSpanKey){
_.arr.each(zoom,function(o){
if(o[0]===p.timeSpanKey){
_unitParas=p._unitParas=o;
return false;
}
});
//give a default key
if(!_unitParas)
_unitParas=p._unitParas=zoom[p.timeSpanKey='1 d'];
}
//if no timeSpanKey( _unitParas) input,
d.zoomDisplay = (p.zoomable && _unitParas)?'':nodisplay
if(_unitParas){
p._unitPixs = p.unitPixs||_unitParas[1];
p._smallLabelCount = p.smallLabelCount||_unitParas[2];
p._smallLabelUnit = p.smallLabelUnit||_unitParas[3];
p._smallLabelFormat = p.smallLabelFormat||_unitParas[4];
p._bigLabelCount = p.bigLabelCount||_unitParas[5];
p._bigLabelUnit = p.bigLabelUnit||_unitParas[6];
p._bigLabelFormat = p.bigLabelFormat||_unitParas[7];
p._timeFormat = p.timeFormat||_unitParas[8];
}
u=p._unitPixs;
smallLabelCount = p._smallLabelCount;
smallLabelUnit = p._smallLabelUnit;
smallLabelFormat = p._smallLabelFormat;
// get bar count in view
_barCount = (Math.ceil(p.width / u)||0);
_leftBarCount = p.leftSpanCount?p.leftSpanCount:_barCount;
_rightBarCount = p.rightSpanCount?p.rightSpanCount:_barCount;
_barCountall = _barCount + _leftBarCount + _rightBarCount;
// ms per px
rate = p._rate = us[smallLabelUnit]*smallLabelCount/u;
//adjust dateStart
if(p.maxDate&& date.add(p.dateStart,'ms',p.width*rate) > p.maxDate)
p.dateStart=date.add(p.maxDate,'ms',-p.width*rate);
if(p.minDate&& p.dateStart<p.minDate)
p.dateStart=p.minDate;
// get the round start from the approximate start
_dateStart = date.getTimSpanStart(p.dateStart, smallLabelUnit, smallLabelCount);
// rel start in band
smallLabelStart=p._smallLabelStart = date.add(_dateStart, smallLabelUnit, -_leftBarCount*smallLabelCount);
// rel to in band
smallLabelEnd = p._smallLabelEnd = date.add(smallLabelStart, smallLabelUnit, _barCountall*smallLabelCount);
// get band with
p._band_width = Math.ceil(date.diff(smallLabelStart,smallLabelEnd, 'ms')/rate);
// set band left
p._band_left_fix = p._band_left = - Math.ceil(date.diff(smallLabelStart, p.dateStart, 'ms')/rate);
// build bars
smallMarks = p._smallMarks = [];
temp=0;
label=date.get(smallLabelStart, smallLabelFormat);
for(i=0; i< _barCountall; i++){
_date = date.add(smallLabelStart, smallLabelUnit, smallLabelCount*(i+1));
width = Math.ceil(date.diff(smallLabelStart, _date, 'ms')/rate);
smallMarks.push({
left : temp,
width : width - temp,
text : label
});
temp=width;
label=date.getText(_date, smallLabelFormat);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -