Skip to content

Commit 2e7e4c6

Browse files
authored
Merge pull request #519 from ecomfe/fix/rect-text-svg
Fix/rect text svg
2 parents 7cbc0e6 + dbdec7c commit 2e7e4c6

18 files changed

+2574
-893
lines changed

src/contain/text.js

+1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export function calculateTextPosition(out, style, rect) {
155155

156156
var x = rect.x;
157157
var y = rect.y;
158+
distance = distance || 0;
158159

159160
var height = rect.height;
160161
var width = rect.width;

src/graphic/Style.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -295,23 +295,31 @@ Style.prototype = {
295295

296296
/**
297297
* Whether transform text.
298-
* Only useful in Path and Image element
298+
* Only available in Path and Image element,
299+
* where the text is called as `RectText`.
299300
* @type {boolean}
300301
*/
301302
transformText: false,
302303

303304
/**
304-
* Text rotate around position of Path or Image
305-
* Only useful in Path and Image element and transformText is false.
305+
* Text rotate around position of Path or Image.
306+
* The origin of the rotation can be specified by `textOrigin`.
307+
* Only available in Path and Image element,
308+
* where the text is called as `RectText`.
306309
*/
307310
textRotation: 0,
308311

309312
/**
310-
* Text origin of text rotation, like [10, 40].
311-
* Based on x, y of rect.
312-
* Useful in label rotation of circular symbol.
313-
* By default, this origin is textPosition.
314-
* Can be 'center'.
313+
* Text origin of text rotation.
314+
* Useful in the case like label rotation of circular symbol.
315+
* Only available in Path and Image element, where the text is called
316+
* as `RectText` and the element is called as "host element".
317+
* The value can be:
318+
* + If specified as a coordinate like `[10, 40]`, it is the `[x, y]`
319+
* base on the left-top corner of the rect of its host element.
320+
* + If specified as a string `center`, it is the center of the rect of
321+
* its host element.
322+
* + By default, this origin is the `textPosition`.
315323
* @type {string|Array.<number>}
316324
*/
317325
textOrigin: null,

0 commit comments

Comments
 (0)