-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add property to inherit onlyVisibleForSeat while dragging. #1357
Conversation
While dragging, inherit the onlyVisibleForSeat property from the current hover target to hide visibility for changes made over a hidden widget.
PR-SERVER-BOT: You can play around with it here: https://test.virtualtabletop.io/PR-1357/pr-test (or any other room on that server) After merging, a backup will be available at https://beta.virtualtabletop.io/editor/PR1357-pr-test. |
Note, this should inherit from ancestor holders too I think. I will add a commit to address this, just wanted to share out the idea. You can try it at https://test.virtualtabletop.io/PR-1357/pr-test |
Now this should inherit from ancestor widgets as well. I've updated the pr-test to show an example of a nested holder without the property set. |
This works as described. The latest commit also makes it work for ancestors. I have a demo in https://test.virtualtabletop.io/PR-1357/lawdawg. The left holder has an ancestor parent widget that is different from the holder and that works. The right holder is a demo of it working without an ancestor. Based on testing, I would approve this. Needs a code review. |
Proposed wiki edit. Add the following new entries to Global properties for every widget:
|
@96LawDawg FYI note that this is the |
I see what you are saying. But I think we should document somehow that it looks up the ancestor tree. The effect will take place even if THIS widget doesn't have the property but an ancestor does. Open to suggestions on how to say that. |
How about something like the following?
Or alternately if we want to more directly match the code:
Let me know if anyone has name suggestions for the property, |
I like a slightly modified version of that: "When dragged, child widgets inherit the
How about just |
Sounds good to me!
My only concern with removing children is that it suggests to me the holder itself inherits the visible for seat, rather than the descendants dragged over it. I was also considering |
How much work would it be to not use It might make the code a lot more messy so this might be the preferable solution. |
I think that the other clients don't know the current hoverTarget, right? Computing it (on all clients) throughout the drag would I think add a bit of complexity*. * unless this already happens? |
Oh yeah, didn't think about that. |
What about just setting a |
@robartsd I really like this idea. I was considering something like this but wasn't sure whether there was any aversion to adding internal state properties, but I think like you said this property would also be helpful for custom behaviors. |
We already have it for Actually, I'm not sure if the |
@robartsd I implemented the suggested approach. It works great - the onlyVisibleForSeat property no longer gets clobbered and we respect the intersection of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes tested and approved. New proposed wiki entry edits suggested above. Please review.
This technique could be used to change the visibility of the cursor with a pretty simple changeRoutine
to check for hoverTarget
and dragging
that wouldn't require a code change. But so far, I can only figure out how to change the cursor transparency for the entire room. @robartsd or anybody ... do you know of a way to change the transparency of the cursor for a specific playerName
? BTW, here is how I change the cursor transparency for the entire room.
"css": {
",.cursor": {
"--cursorActiveOpacity": 0,
"--cursorPressedOpacity": 0
}
}
FWIW I still feel like it would be a sensible default behavior for the drag visibility for others to match what it would be after dropping a dragged item, however adding this property to holders as well as |
I would not add the underscore prefix. I don’t think this is virtual in the same sense that the true virtual properties are. As for being able to SET it, I can’t think of when I would want to, but why prohibit it? I can’t think of a reason for that either. So just leave max flexibility for game designer. |
On second thought I can think of a use case for SETting the property. Maybe I want to turn it off if x>1000, so allowing me to SET it would allow me to override the normal behavior I want if x<1000. |
Another question is should the cursor also disappear when this property is set - since it has similar semantics as not technically a child but being dragged over a hidden widget. I think this could probably be done after as a followup - but just throwing the idea out there. |
I'm not sure I follow the use case. You want to replace the hoverTarget if x>1000? Would you expect the dragged item to drop into the replaced hoverTarget if released? If so, I'd need to replace the reference to |
I don't think you should hide the cursor. That would most likely cause confusion. |
Well, it's not a real use case because I don't really know how I would use it in a game. But being able to SET a property (rather than putting it on a list of properties that cannot be SET) gives me more options as a game designer. Just for example of how it might work, look at https://test.virtualtabletop.io/PR-1357/lawdawg. Watch the JSON of a card change over the hand as the x coord gets to 1000. That might allow me to do something. So leave it as is. And, no, don't cause that to drop. That would be the point of overwriting it is to cause it NOT to drop for some reason. |
My thinking here is if someone's interacting with content I can't see, it's more confusing to see their cursor moving around over the things that I see in that place instead. Also, it would hide "private" information. However, if it's contentious I'll open a separate issue for discussion. |
Oh. You mean hide other players' cursors. That would be a nice option to have, but I wouldn't make it the default. That was one thing I was trying to do with my demo room, but it is tricky applying the CSS needed to just one player. But if it was built into the code and there was a property or parameter for turning it on and off, that would be sweet. |
I'm finding that I'd really like to have dragged pieces also apply the scale of the container they're dragged over so you don't get the effect of pieces on scaled holders changing size when you pick them up and again when you drop them. Do you think this would be reasonable to add to the same property, and call it something like |
That would be a really nice feature. I don't think it is related in any way to But that is probably a different paramater/property or whatever. I can't keep all those terms straight. |
Sounds good, I opened a new issue for it: #1379 I think this PR is ready to land given the decisions we made about it needing a property and not rewriting games yet, just needs a code review. |
I wonder if we should replace |
Yes, I like |
Perhaps |
Updates to the Global Widget Properties table in the wiki:
|
Yep, can do this. I'm planning to also reuse the added |
How close do we think this PR is to being ready? This is the thing I needed for so many games that I didn't know I needed until now. Now I have a game that I want to make using this. I know I could make it in the PR test rooms, but I'm hoping this will be ready soon. |
I believe this is just waiting on a code review. I think we've thrown around enough ideas for alternatives that the property changes we have for this now is reasonable. We've also updated this to be the default with fileupdater for older games. @ArnoldSmith86 have you had a chance to look at the code change? |
It will be ready sooner if you test it by making games in the PR test rooms. |
While dragging, inherit the onlyVisibleForSeat property from the current hover target to hide visibility for changes made over a hidden widget. Fixes #1356.