Resonite-Issues icon indicating copy to clipboard operation
Resonite-Issues copied to clipboard

Prevent TextEditor receving a value from its own object

Open lill-la opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe.

値がnullのTextEditorはそのButtonの位置でグラブできます。 グラブして離したとき、TextEditorのある同じオブジェクト内にValueFieldがあると、その値がtextにセットされてしまいます。 グラブしても値の変わらないTextEditorが欲しいです。

A TextEditor with a value of null can be grabbed at its Button position. When it is grabbed and released, if there is a ValueField in the same object where the TextEditor is located, its value will be set to text. I would like a TextEditor that doesn't change the value when I grab it.

Describe the solution you'd like

どれか1つ

  • TextEditorが自身のオプジェクトのValueFiledやValueProxyから値を受け取らないようにする
  • ValueFieldに、リリースされたとき値をTextEditorやValueReceiverに入れないオプションをつける
  • 値がnullのTextEditorをグラブすると、そのオブジェクトをグラブするのではなく、nullを値としてグラブする

Any one of these

  • Prevent TextEditor from receiving values from its own object's ValueFiled or ValueProxy
  • Give ValueField an option to not put values into TextEditor or ValueReceiver when they are released
  • Grabbing a TextEditor with a null value will not grab the object, but will grab null as the value

Describe alternatives you've considered

TextEditorのFinishHandlingをLeaveAsIsにして初期値を空文字列にしておけば、値がnullになることが無いのでこの問題は発生しません。 しかしその場合TextのNullContentが使えなくなってしまいます。

ValueFieldの代わりにDynamicValueVariableを使う方法があります。 これはコンポーネントの用途に反した使い方なので、開発上の分かりづらさが増えます。

If you set the TextEditor's FinishHandling to LeaveAsIs and set the initial value to an empty string, this problem will not occur because the value will never be null. However, in that case, Text's NullContent will no longer be available.

Instead of using a ValueField, you can use a DynamicValueVariable. This is not the intended use of the component, so it is more confusing for development.

Additional Context

Simple text filed item to reproduce (rename zip to resonitepackage)

この問題はインスペクター上のnullableな値の位置で誤ってグラブしてしまったときに、インスペクター内のValueFieldの値がセットされてしまい、気がつかないことがあるという問題をたまに引き起こしています。

そもそもValueFieldがValueProxyのような挙動をするのは仕様なのでしょうか?

This problem sometimes causes problems when a ValueField in the inspector is set and unnoticed when it is accidentally grabbed in the position of a nullable value on the inspector.

To begin with, is it a specification that ValueField behaves like ValueProxy?

Requesters

lill / lill.la

lill-la avatar Oct 05 '24 09:10 lill-la

To begin with, is it a specification that ValueField behaves like ValueProxy?

I believe so, yes. This is a pretty useful property, it's just unfortunate that you can drop an object "into itself" if you're releasing it when your laser is over a text field. My simple user list actually has that issue since I added a searchbar, if you grab it by the search bar and release it it will paste the FPS of the first user in the list into the search field, which is... undesired. I might restructure it so the first value source in the hierarchy is the value of the search field itself, that way you would only ever copy its own value into itself, but that's just a workaround and messy.

JackTheFoxOtter avatar Oct 07 '24 12:10 JackTheFoxOtter

That said this should continue to work if you are grabbing an explicit value / reference proxy, sometimes you do explicitly want to copy an objects reference into itself. (Or just copying a value from one input field into another) Imagine for example if you have a slot counter and want to count its own slots.

JackTheFoxOtter avatar Oct 07 '24 12:10 JackTheFoxOtter

This is more of a bug. Can you provide replication steps for this please?

Frooxius avatar Oct 10 '24 00:10 Frooxius

  1. Make UIX object with TextEditor, TextField, Text, Button.
  2. Attach any ValueField component to any slot of the UIX object.
  3. Grab the TextEditor area and release.

lill-la avatar Oct 10 '24 01:10 lill-la