I use the following code to draw an SVG text box, and then change its text anchor attribute to "left", because by default it is centered and this is unpleasant.
The text is generated correctly, but when I add this second line, I get the error message "this.textBox.style is undefined" in my error console.
Here is my code:
RenderTextBox:function() { // Render Text this.textBox = paper.text(this.x, this.y, this.htmlText); this.textBox.style.textAnchor="left"; }
Any ideas?
I think you want to do
this.textBox.setAttribute('text-anchor', 'start');
(or since it looks like you are using Raphael)
this.textBox.attr( 'text-anchor', 'start' );
Acceptable values for text-anchorare start, middle, endandinherit
text-anchor
start
middle
end
inherit
:
this.textBox.style['text-anchor'] = "left";
, .
Source: https://habr.com/ru/post/1749422/More articles:How can I implicitly convert another structure to my type? - variable-assignmentLinux real-mode interface in the Linux kernel module - cGet FixedDocuments from FixedDocumentSequence - c #Design Solution - Scaling Web Application Architecture - architectureCalculating the correlation coefficient using PostgreSQL? - postgresqlSilverlight or MVC for web development - asp.net-mvcHow to add an image field to a Rails application? - ruby-on-railsCan Python ctypes load a 32-bit C library on x86-64? - pythonWhat is the best way to test a mobile site in Visual Studio 2010? - visual-studioWhy does this regex fail? - phpAll Articles