MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / transformDirection

Function transformDirection

libs/echarts/echarts.simple.js:18023–18041  ·  view source on GitHub ↗

* @param {string} direction 'left' 'right' 'top' 'bottom' * @param {Array. } transform Transform matrix: like [1, 0, 0, 1, 0, 0] * @param {boolean=} invert Whether use invert matrix. * @return {string} Transformed direction. 'left' 'right' 'top' 'bottom'

(direction, transform, invert$$1)

Source from the content-addressed store, hash-verified

18021 * @return {string} Transformed direction. 'left' 'right' 'top' 'bottom'
18022 */
18023function transformDirection(direction, transform, invert$$1) {
18024
18025 // Pick a base, ensure that transform result will not be (0, 0).
18026 var hBase = (transform[4] === 0 || transform[5] === 0 || transform[0] === 0)
18027 ? 1 : Math.abs(2 * transform[4] / transform[0]);
18028 var vBase = (transform[4] === 0 || transform[5] === 0 || transform[2] === 0)
18029 ? 1 : Math.abs(2 * transform[4] / transform[2]);
18030
18031 var vertex = [
18032 direction === 'left' ? -hBase : direction === 'right' ? hBase : 0,
18033 direction === 'top' ? -vBase : direction === 'bottom' ? vBase : 0
18034 ];
18035
18036 vertex = applyTransform$1(vertex, transform, invert$$1);
18037
18038 return Math.abs(vertex[0]) > Math.abs(vertex[1])
18039 ? (vertex[0] > 0 ? 'right' : 'left')
18040 : (vertex[1] > 0 ? 'bottom' : 'top');
18041}
18042
18043/**
18044 * Apply group transition animation from g1 to g2.

Callers

nothing calls this directly

Calls 1

applyTransform$1Function · 0.70

Tested by

no test coverage detected