This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
SVG_SET_STROKE_VECTOR_EFFECT

SVG_SET_STROKE_VECTOR_EFFECT 


 

SVG_SET_STROKE_VECTOR_EFFECT ( svgObj {; vectorEffect} ) 
Parameter Type   Description
svgObj  SVG_Ref in Reference of SVG element
vectorEffect  String in "non-scaling-stroke", "none", "inherit"

The SVG_SET_STROKE_VECTOR_EFFECT command sets the vector-effect attribute for the lines of the svgObj. The vector-effect attribute specifies the behavior of an object's stroke if the object is transformed, for example by zooming in or out. 

In the svgObj parameter, pass a reference to the SVG element whose vector-effect attribute will be set. If svgObj does not reference an SVG element, an error is generated. If the vector-effect attribute has already been defined, its value is replaced by the vectorEffect parameter.

The optional vectorEffect parameter indicates the value to be used for the attribute. The following values are available:

 

vectorEffectDescription
"non-scaling-stroke"Stroke (line) width is not dependant on the transformations of the element 
"none"No vector effect is applied
"inherit"The value of the element's parent is used

If vectorEffect is omitted, the vector-effect attribute is removed (equivalent to "none"). 

Example  

The following code creates a rectangle and resizes it:

 C_TEXT($Dom_rect;$Dom_svg)
 $Dom_svg:=SVG_New
 $Dom_rect:=SVG_New_rect($Dom_svg;10;10;100;100;0;0;"blue";"red")
 SVG_SET_STROKE_WIDTH($Dom_rect;2;"px")
 
  // Redimension
 SVG_SET_TRANSFORM_SCALE($Dom_rect;4;1)

By default, line thickness is modified: 

To resize without changing line thickness, add SVG_SET_STROKE_VECTOR_EFFECT:

 C_TEXT($Dom_rect;$Dom_svg)
 $Dom_svg:=SVG_New
 $Dom_rect:=SVG_New_rect($Dom_svg;10;10;100;100;0;0;"blue";"red")
 SVG_SET_STROKE_WIDTH($Dom_rect;2;"px")
 
  // Redimension
 SVG_SET_TRANSFORM_SCALE($Dom_rect;4;1)
 
  // Set non-scalling
 SVG_SET_STROKE_VECTOR_EFFECT($Dom_rect;"non-scaling-stroke")

The line thickness is not modified:

 
PROPERTIES 

Product: 4D
Theme: Attributes

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v18

 
ARTICLE USAGE

4D SVG Component ( 4D v20 R7)