DrawNode (thickness != 1) is bigger/smaller as expected. What can I do? #2324
-
Beta Was this translation helpful? Give feedback.
Replies: 16 comments 16 replies
-
If the thickness is being scaled, then isn't the existing behavior correct? For example, if you draw a line of thickness 1, and the contentScaleFactor is 2, then the line drawn should be be 2 pixels thick. Isn't that the purpose of the content scale factor, or am I misunderstanding it? If you have a content scale factor that is not equal to 1, yet you require the lines to not be affected by it, then wouldn't the following work?
|
Beta Was this translation helpful? Give feedback.
-
i tested, even when _contentScaleFactor = 1, the error still occurs, However, I have an app with contentScaleFactor = 10, and lines with thickness!= are drawn much larger |
Beta Was this translation helpful? Give feedback.
-
OK, in that case it may be a bug. @aismann would the one who is familiar with the DrawNode implementation. |
Beta Was this translation helpful? Give feedback.
-
sorry for the misinformation, but it seems _contentScaleFactor doesn't affect drawNode |
Beta Was this translation helpful? Give feedback.
-
@NgVThangBz
A faster way is using a defined thickness array:
|
Beta Was this translation helpful? Give feedback.
-
@aismann |
Beta Was this translation helpful? Give feedback.
-
@NgVThangBz |
Beta Was this translation helpful? Give feedback.
-
Maybe I add a new property: But the problem is: |
Beta Was this translation helpful? Give feedback.
-
it seems that : _contentScaleFactor is not the cause, |
Beta Was this translation helpful? Give feedback.
-
@aismann |
Beta Was this translation helpful? Give feedback.
-
i think factor = (FrameSize /designResolutionSize)*2 |
Beta Was this translation helpful? Give feedback.
-
@NgVThangBz
|
Beta Was this translation helpful? Give feedback.
-
@NgVThangBz |
Beta Was this translation helpful? Give feedback.
-
@NgVThangBz
DrawNode 2.0 is supporting thickness again but in a different way. My proposal after some tests: Because of this I think a "Function Pointer" like:
Automatic via "Function Pointer":
Manuell via
"Extrem example":
Using "height = factor 4"
Using "width = factor 1.122"
Can you tell my your g_resourceSize, g_designSize? and your max/min display sizes? |
Beta Was this translation helpful? Give feedback.
-
@NgVThangBz |
Beta Was this translation helpful? Give feedback.
-
I will close it thinking about a PR. |
Beta Was this translation helpful? Give feedback.
@NgVThangBz
Some background info: (see also #1411 (comment))
DrawNode 2.0 is supporting thickness again but in a different way.
My proposal after some tests:
There is no "standard" function to get the right factor for the correct thickness (See the "extrem example").
Because of this I think a "Function Pointer" like:
void setFactorFunction(float (*funcPtr)())
andsetFactor(yourFactor)
method.If the "default factor =
Director::getInstance()->getContentScaleFactor()
" not working for your situation you can overwrite the factor method with your own function (your factor …