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

Method getPositionX

src/openlayers/core/StyleUtils.js:902–917  ·  view source on GitHub ↗

* 得到绘制的起点位置,根据align不同,位置也不同 * @param textAlign * @returns {number}

(textAlign, canvasWidth)

Source from the content-addressed store, hash-verified

900 * @returns {number}
901 */
902 static getPositionX(textAlign, canvasWidth) {
903 let x;
904 let width = canvasWidth - doublePadding; //减去padding
905 switch (textAlign) {
906 case 'center':
907 x = width / 2;
908 break;
909 case 'right':
910 x = width;
911 break;
912 default:
913 x = 8;
914 break;
915 }
916 return x;
917 }
918
919 /**
920 * @function StyleUtils.hexToRgb

Callers 2

canvasTextAutoLineMethod · 0.95
StyleUtils2Spec.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected