mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 23:29:49 +00:00
fix: ui
This commit is contained in:
@@ -111,7 +111,7 @@ var BMapLib = window.BMapLib = BMapLib || {};
|
||||
* girdSize {Number} 聚合计算时网格的像素大小,默认60<br />
|
||||
* maxZoom {Number} 最大的聚合级别,大于该级别就不进行相应的聚合<br />
|
||||
* minClusterSize {Number} 最小的聚合数量,小于该数量的不能成为一个聚合,默认为2<br />
|
||||
* isAverangeCenter {Boolean} 聚合点的落脚位置是否是所有聚合在内点的平均值,默认为否,落脚在聚合内的第一个点<br />
|
||||
* isAvgCenter {Boolean} 聚合点的落脚位置是否是所有聚合在内点的平均值,默认为否,落脚在聚合内的第一个点<br />
|
||||
* styles {Array<IconStyle>} 自定义聚合后的图标风格,请参考TextIconOverlay类<br />
|
||||
*/
|
||||
BMapLib.MarkerCluster = function(map, options){
|
||||
@@ -142,8 +142,8 @@ var BMapLib = window.BMapLib = BMapLib || {};
|
||||
// that._redraw();
|
||||
// });
|
||||
|
||||
var mkrs = opts["markers"];
|
||||
isArray(mkrs) && this.addMarkers(mkrs);
|
||||
var markers = opts["markers"];
|
||||
isArray(markers) && this.addMarkers(markers);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -454,19 +454,19 @@ var BMapLib = window.BMapLib = BMapLib || {};
|
||||
* Cluster
|
||||
* @class 表示一个聚合对象,该聚合,包含有N个标记,这N个标记组成的范围,并有予以显示在Map上的TextIconOverlay等。
|
||||
* @constructor
|
||||
* @param {MarkerCluster} markerClusterer 一个标记聚合器示例。
|
||||
* @param {MarkerCluster} markerCluster 一个标记聚合器示例。
|
||||
*/
|
||||
function Cluster(markerClusterer){
|
||||
this._markerClusterer = markerClusterer;
|
||||
this._map = markerClusterer.getMap();
|
||||
this._minClusterSize = markerClusterer.getMinClusterSize();
|
||||
this._isAverageCenter = markerClusterer.isAverageCenter();
|
||||
function Cluster(markerCluster){
|
||||
this._markerCluster = markerCluster;
|
||||
this._map = markerCluster.getMap();
|
||||
this._minClusterSize = markerCluster.getMinClusterSize();
|
||||
this._isAverageCenter = markerCluster.isAverageCenter();
|
||||
this._center = null;//落脚位置
|
||||
this._markers = [];//这个Cluster中所包含的markers
|
||||
this._gridBounds = null;//以中心点为准,向四边扩大gridSize个像素的范围,也即网格范围
|
||||
this._isReal = false; //真的是个聚合
|
||||
|
||||
this._clusterMarker = new BMapLib.TextIconOverlay(this._center, this._markers.length, {"styles":this._markerClusterer.getStyles()});
|
||||
this._clusterMarker = new BMapLib.TextIconOverlay(this._center, this._markers.length, {"styles":this._markerCluster.getStyles()});
|
||||
//this._map.addOverlay(this._clusterMarker);
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ var BMapLib = window.BMapLib = BMapLib || {};
|
||||
*/
|
||||
Cluster.prototype.updateGridBounds = function() {
|
||||
var bounds = new BMapGL.Bounds(this._center, this._center);
|
||||
this._gridBounds = getExtendedBounds(this._map, bounds, this._markerClusterer.getGridSize());
|
||||
this._gridBounds = getExtendedBounds(this._map, bounds, this._markerCluster.getGridSize());
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -560,7 +560,7 @@ var BMapLib = window.BMapLib = BMapLib || {};
|
||||
* @return 无返回值。
|
||||
*/
|
||||
Cluster.prototype.updateClusterMarker = function () {
|
||||
if (this._map.getZoom() > this._markerClusterer.getMaxZoom()) {
|
||||
if (this._map.getZoom() > this._markerCluster.getMaxZoom()) {
|
||||
this._clusterMarker && this._map.removeOverlay(this._clusterMarker);
|
||||
for (var i = 0, marker; marker = this._markers[i]; i++) {
|
||||
this._map.addOverlay(marker);
|
||||
@@ -589,9 +589,9 @@ var BMapLib = window.BMapLib = BMapLib || {};
|
||||
return;
|
||||
}
|
||||
clickTimeout = setTimeout(() => {
|
||||
if (this._markerClusterer && typeof this._markerClusterer.getCallback() === 'function') {
|
||||
if (this._markerCluster && typeof this._markerCluster.getCallback() === 'function') {
|
||||
const markers = this._markers;
|
||||
this._markerClusterer.getCallback()(event, markers);
|
||||
this._markerCluster.getCallback()(event, markers);
|
||||
}
|
||||
clickTimeout = null;
|
||||
}, 300); // Delay to differentiate between single and double click
|
@@ -211,7 +211,7 @@ var BMapLib = window.BMapLib = BMapLib || {};
|
||||
* @returns {string} 驼峰化处理后的字符串
|
||||
*/
|
||||
baidu.string.toCamelCase = function (source) {
|
||||
//提前判断,提高getStyle等的效率 thanks xianwei
|
||||
//提前判断,提高getStyle等的效率
|
||||
if (source.indexOf('-') < 0 && source.indexOf('_') < 0) {
|
||||
return source;
|
||||
}
|
||||
@@ -649,7 +649,7 @@ var BMapLib = window.BMapLib = BMapLib || {};
|
||||
* @grammar obj.dispatchEvent(event, options)
|
||||
* @param {baidu.lang.Event|String} event Event对象,或事件名称(1.1.1起支持)
|
||||
* @param {Object} options 扩展参数,所含属性键值会扩展到Event对象上(1.2起支持)
|
||||
* @remark 处理会调用通过addEventListenr绑定的自定义事件回调函数之外,还会调用直接绑定到对象上面的自定义事件。例如:<br>
|
||||
* @remark 处理会调用通过addEventListener绑定的自定义事件回调函数之外,还会调用直接绑定到对象上面的自定义事件。例如:<br>
|
||||
myobj.onMyEvent = function(){}<br>
|
||||
myobj.addEventListener("onMyEvent", function(){});
|
||||
*/
|
||||
@@ -767,7 +767,7 @@ var BMapLib = window.BMapLib = BMapLib || {};
|
||||
};
|
||||
|
||||
/**
|
||||
*继承Overlay的intialize方法,自定义覆盖物时必须。
|
||||
*继承Overlay的initialize方法,自定义覆盖物时必须。
|
||||
*@param {Map} map BMapGL.Map的实例化对象。
|
||||
*@return {HTMLElement} 返回覆盖物对应的HTML元素。
|
||||
*/
|
||||
@@ -860,21 +860,20 @@ var BMapLib = window.BMapLib = BMapLib || {};
|
||||
var style = this.getStyleByText(this._text, this._styles);
|
||||
var newStyle = {
|
||||
url: imageUrl,
|
||||
size: {width: 72, height: 72}
|
||||
size: { width: 86, height: 86 }
|
||||
}
|
||||
if (imageUrl) {
|
||||
style = Object.assign(style, {url: imageUrl, size: {width: 72, height: 72}})
|
||||
style = Object.assign(style, { url: imageUrl, size: { width: 86, height: 86 } })
|
||||
}
|
||||
|
||||
const customImageNumber = `<span class="custom-image-number">${this._text}</span>`;
|
||||
const customImageNumber = `<span class="custom-image-number">${this._text < 1000 ? this._text : '1k+'}</span>`;
|
||||
this._domElement.style.cssText = this.buildImageCssText(newStyle);
|
||||
const imageElement = `<img src=${imageUrl} width="72" height="72" />`
|
||||
const imageElement = `<img src=${imageUrl} width="80" height="80" />`
|
||||
const htmlString = `
|
||||
<div class="custom-image-container">
|
||||
${this._text > 1 ? customImageNumber : ''}
|
||||
${imageUrl ? imageElement : '<div class="empty-custom-image-wrapper"></div>'}
|
||||
<i class='plugin-label-arrow dtable-font dtable-icon-drop-down'></i>
|
||||
</div>
|
||||
<div class="custom-image-container">
|
||||
${this._text > 1 ? customImageNumber : ''}
|
||||
${imageUrl ? imageElement : '<div class="empty-custom-image-wrapper"></div>'}
|
||||
</div>
|
||||
`
|
||||
const labelDocument = new DOMParser().parseFromString(htmlString, 'text/html');
|
||||
const label = labelDocument.body.firstElementChild;
|
||||
@@ -888,14 +887,14 @@ var BMapLib = window.BMapLib = BMapLib || {};
|
||||
var textColor = style['textColor'] || 'black';
|
||||
var textSize = style['textSize'] || 10;
|
||||
|
||||
var csstext = [];
|
||||
var cssText = [];
|
||||
|
||||
csstext.push('height:' + size.height + 'px; line-height:' + size.height + 'px;');
|
||||
csstext.push('width:' + size.width + 'px; text-align:center;');
|
||||
cssText.push('height:' + size.height + 'px; line-height:' + size.height + 'px;');
|
||||
cssText.push('width:' + size.width + 'px; text-align:center;');
|
||||
|
||||
csstext.push('cursor:pointer; color:' + textColor + '; position:absolute; font-size:' +
|
||||
cssText.push('cursor:pointer; color:' + textColor + '; position:absolute; font-size:' +
|
||||
textSize + 'px; font-family:Arial,sans-serif; font-weight:bold');
|
||||
return csstext.join('');
|
||||
return cssText.join('');
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -937,34 +936,34 @@ var BMapLib = window.BMapLib = BMapLib || {};
|
||||
var textColor = style['textColor'] || 'black';
|
||||
var textSize = style['textSize'] || 10;
|
||||
|
||||
var csstext = [];
|
||||
var cssText = [];
|
||||
if (T.browser["ie"] < 7) {
|
||||
csstext.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(' +
|
||||
cssText.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(' +
|
||||
'sizingMethod=scale,src="' + url + '");');
|
||||
} else {
|
||||
csstext.push('background-image:url(' + url + ');');
|
||||
cssText.push('background-image:url(' + url + ');');
|
||||
var backgroundPosition = '0 0';
|
||||
(offset instanceof BMapGL.Size) && (backgroundPosition = offset.width + 'px' + ' ' + offset.height + 'px');
|
||||
csstext.push('background-position:' + backgroundPosition + ';');
|
||||
cssText.push('background-position:' + backgroundPosition + ';');
|
||||
}
|
||||
|
||||
if (size instanceof BMapGL.Size){
|
||||
if (anchor instanceof BMapGL.Size) {
|
||||
if (anchor.height > 0 && anchor.height < size.height) {
|
||||
csstext.push('height:' + (size.height - anchor.height) + 'px; padding-top:' + anchor.height + 'px;');
|
||||
cssText.push('height:' + (size.height - anchor.height) + 'px; padding-top:' + anchor.height + 'px;');
|
||||
}
|
||||
if(anchor.width > 0 && anchor.width < size.width){
|
||||
csstext.push('width:' + (size.width - anchor.width) + 'px; padding-left:' + anchor.width + 'px;');
|
||||
cssText.push('width:' + (size.width - anchor.width) + 'px; padding-left:' + anchor.width + 'px;');
|
||||
}
|
||||
} else {
|
||||
csstext.push('height:' + size.height + 'px; line-height:' + size.height + 'px;');
|
||||
csstext.push('width:' + size.width + 'px; text-align:center;');
|
||||
cssText.push('height:' + size.height + 'px; line-height:' + size.height + 'px;');
|
||||
cssText.push('width:' + size.width + 'px; text-align:center;');
|
||||
}
|
||||
}
|
||||
|
||||
csstext.push('cursor:pointer; color:' + textColor + '; position:absolute; font-size:' +
|
||||
cssText.push('cursor:pointer; color:' + textColor + '; position:absolute; font-size:' +
|
||||
textSize + 'px; font-family:Arial,sans-serif; font-weight:bold');
|
||||
return csstext.join('');
|
||||
return cssText.join('');
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user