|
|
@ -8,74 +8,77 @@ import { Cache } from "../structure"; |
|
|
|
const PropertyDescriptors = {}; |
|
|
|
const PropertyDescriptors = {}; |
|
|
|
|
|
|
|
|
|
|
|
export let EVENT_RESPONSE_TIME = 200; |
|
|
|
export let EVENT_RESPONSE_TIME = 200; |
|
|
|
|
|
|
|
export const setEventResponseTime = v => { |
|
|
|
|
|
|
|
EVENT_RESPONSE_TIME = v; |
|
|
|
|
|
|
|
}; |
|
|
|
PropertyDescriptors["EVENT_RESPONSE_TIME"] = { |
|
|
|
PropertyDescriptors["EVENT_RESPONSE_TIME"] = { |
|
|
|
enumerable: true, |
|
|
|
enumerable: true, |
|
|
|
configurable: true, |
|
|
|
configurable: true, |
|
|
|
get: function () { |
|
|
|
get: function () { |
|
|
|
return EVENT_RESPONSE_TIME; |
|
|
|
return EVENT_RESPONSE_TIME; |
|
|
|
}, |
|
|
|
}, |
|
|
|
set: function(newVal) { |
|
|
|
set: setEventResponseTime, |
|
|
|
EVENT_RESPONSE_TIME = newVal; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export let pixUnit = "px"; |
|
|
|
export let pixUnit = "px"; |
|
|
|
|
|
|
|
export const setPixUnit = v => { |
|
|
|
|
|
|
|
pixUnit = v; |
|
|
|
|
|
|
|
}; |
|
|
|
PropertyDescriptors["pixUnit"] = { |
|
|
|
PropertyDescriptors["pixUnit"] = { |
|
|
|
enumerable: true, |
|
|
|
enumerable: true, |
|
|
|
configurable: true, |
|
|
|
configurable: true, |
|
|
|
get: function () { |
|
|
|
get: function () { |
|
|
|
return pixUnit; |
|
|
|
return pixUnit; |
|
|
|
}, |
|
|
|
}, |
|
|
|
set: function(newVal) { |
|
|
|
set: setPixUnit, |
|
|
|
pixUnit = newVal; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export let pixRatio = 1; |
|
|
|
export let pixRatio = 1; |
|
|
|
|
|
|
|
export const setPixRatio = v => { |
|
|
|
|
|
|
|
pixRatio = v; |
|
|
|
|
|
|
|
}; |
|
|
|
PropertyDescriptors["pixRatio"] = { |
|
|
|
PropertyDescriptors["pixRatio"] = { |
|
|
|
enumerable: true, |
|
|
|
enumerable: true, |
|
|
|
configurable: true, |
|
|
|
configurable: true, |
|
|
|
get: function () { |
|
|
|
get: function () { |
|
|
|
return pixRatio; |
|
|
|
return pixRatio; |
|
|
|
}, |
|
|
|
}, |
|
|
|
set: function(newVal) { |
|
|
|
set: setPixRatio, |
|
|
|
pixRatio = newVal; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export let StartOfWeek = 1; |
|
|
|
export let StartOfWeek = 1; |
|
|
|
|
|
|
|
export const setStartOfWeek = v => { |
|
|
|
|
|
|
|
StartOfWeek = v; |
|
|
|
|
|
|
|
}; |
|
|
|
PropertyDescriptors["StartOfWeek"] = { |
|
|
|
PropertyDescriptors["StartOfWeek"] = { |
|
|
|
enumerable: true, |
|
|
|
enumerable: true, |
|
|
|
configurable: true, |
|
|
|
configurable: true, |
|
|
|
get: function () { |
|
|
|
get: function () { |
|
|
|
return StartOfWeek; |
|
|
|
return StartOfWeek; |
|
|
|
}, |
|
|
|
}, |
|
|
|
set: function(newVal) { |
|
|
|
set: setStartOfWeek, |
|
|
|
StartOfWeek = newVal; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export let BlankSplitChar = "\u200b \u200b"; |
|
|
|
export let BlankSplitChar = "\u200b \u200b"; |
|
|
|
|
|
|
|
export const setBlankSplitChar = v => { |
|
|
|
|
|
|
|
BlankSplitChar = v; |
|
|
|
|
|
|
|
}; |
|
|
|
PropertyDescriptors["BlankSplitChar"] = { |
|
|
|
PropertyDescriptors["BlankSplitChar"] = { |
|
|
|
enumerable: true, |
|
|
|
enumerable: true, |
|
|
|
configurable: true, |
|
|
|
configurable: true, |
|
|
|
get: function () { |
|
|
|
get: function () { |
|
|
|
return BlankSplitChar; |
|
|
|
return BlankSplitChar; |
|
|
|
}, |
|
|
|
}, |
|
|
|
set: function(newVal) { |
|
|
|
set: setBlankSplitChar, |
|
|
|
BlankSplitChar = newVal; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 一定返回最终的单位
|
|
|
|
// 一定返回最终的单位
|
|
|
|
export function pixFormat(pix, border) { |
|
|
|
export let pixFormat = (pix, border) => { |
|
|
|
if (!isNumber(pix)) { |
|
|
|
if (!isNumber(pix)) { |
|
|
|
return pix; |
|
|
|
return pix; |
|
|
|
} |
|
|
|
} |
|
|
|
if (pixUnit === "px") { |
|
|
|
if (pixUnit === "px") { |
|
|
|
return (pix / pixRatio - (border || 0)) + pixUnit; |
|
|
|
return pix / pixRatio - (border || 0) + pixUnit; |
|
|
|
} |
|
|
|
} |
|
|
|
const length = pix / pixRatio + pixUnit; |
|
|
|
const length = pix / pixRatio + pixUnit; |
|
|
|
if (border > 0) { |
|
|
|
if (border > 0) { |
|
|
@ -83,20 +86,20 @@ export function pixFormat(pix, border) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return length; |
|
|
|
return length; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
export const setPixFormat = v => { |
|
|
|
|
|
|
|
pixFormat = v; |
|
|
|
|
|
|
|
}; |
|
|
|
PropertyDescriptors["pixFormat"] = { |
|
|
|
PropertyDescriptors["pixFormat"] = { |
|
|
|
enumerable: true, |
|
|
|
enumerable: true, |
|
|
|
configurable: true, |
|
|
|
configurable: true, |
|
|
|
get: function () { |
|
|
|
get: function () { |
|
|
|
return pixFormat; |
|
|
|
return pixFormat; |
|
|
|
}, |
|
|
|
}, |
|
|
|
set: function(newVal) { |
|
|
|
set: setPixFormat, |
|
|
|
pixFormat = newVal; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export let toPix = (pix, border) => { |
|
|
|
export function toPix(pix, border) { |
|
|
|
|
|
|
|
if (!isNumber(pix)) { |
|
|
|
if (!isNumber(pix)) { |
|
|
|
return pix; |
|
|
|
return pix; |
|
|
|
} |
|
|
|
} |
|
|
@ -108,30 +111,34 @@ export function toPix(pix, border) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return pix; |
|
|
|
return pix; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
export let setToPix = v => { |
|
|
|
|
|
|
|
toPix = v; |
|
|
|
|
|
|
|
}; |
|
|
|
PropertyDescriptors["toPix"] = { |
|
|
|
PropertyDescriptors["toPix"] = { |
|
|
|
enumerable: true, |
|
|
|
enumerable: true, |
|
|
|
configurable: true, |
|
|
|
configurable: true, |
|
|
|
get: function () { |
|
|
|
get: function () { |
|
|
|
return toPix; |
|
|
|
return toPix; |
|
|
|
}, |
|
|
|
}, |
|
|
|
set: function(newVal) { |
|
|
|
set: setToPix, |
|
|
|
toPix = newVal; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getCacheItem = key => { |
|
|
|
export let EVENT_BLUR = _global.localStorage ? Cache.getItem("event.blur", {typeConversion: true, defaultValue: true}) : true; |
|
|
|
Cache.getItem(key, { typeConversion: true, defaultValue: true }); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
export let EVENT_BLUR = _global.localStorage ? getCacheItem("event.blur") : true; |
|
|
|
|
|
|
|
export const setEventBlur = v => { |
|
|
|
|
|
|
|
EVENT_BLUR = v; |
|
|
|
|
|
|
|
Cache.setItem("event.blur", newVal); |
|
|
|
|
|
|
|
}; |
|
|
|
PropertyDescriptors["EVENT_BLUR"] = { |
|
|
|
PropertyDescriptors["EVENT_BLUR"] = { |
|
|
|
enumerable: true, |
|
|
|
enumerable: true, |
|
|
|
configurable: true, |
|
|
|
configurable: true, |
|
|
|
get: function () { |
|
|
|
get: function () { |
|
|
|
return EVENT_BLUR; |
|
|
|
return EVENT_BLUR; |
|
|
|
}, |
|
|
|
}, |
|
|
|
set: function(newVal) { |
|
|
|
set: setEventBlur, |
|
|
|
EVENT_BLUR = newVal |
|
|
|
|
|
|
|
Cache.setItem("event.blur", newVal) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export function _defineVarProperties(libName) { |
|
|
|
export function _defineVarProperties(libName) { |
|
|
|