Im grouping <a-box>'es with a <a-entity> wrapper.
Then, Im using the cursor component in the <scene> and trying to pick/select individual objects that make up the <a-entity> wrapper, yet only wrapper <a-entity> gets selected, not the individual objects.
Im really curious about this. I looked at all the aframe cursor (https://aframe.io/docs/0.2.0/components/cursor.html) docs, and there is no specific mention of this scenario. It does mention that the raycaster(https://aframe.io/docs/0.2.0/components/raycaster.html) used by the cursor returns the first entity that is intersecting with the projected ray... which would be the grouped entity... so always returning it makes sense.
everything works fine when all the <a-box>'es are attached to the global <a-scene>, and they can be selected individually.
Am I correct to assume that picking only works correctly when the particular object is a global entity (not a nested one)?
Not exactly. you can add a raycaster component to cursor entity. and set specific objects which you want to pick. you can see this question I asked before how to set “objects” property in aframe raycaster component .
Related
I'm working on a game that uses QML for its UI.
I would like to replace all cursors appearances with cursor-images that are more fitting to the game style (e.g. pointing skeleton hand instead of the normal Qt::ArrowCursor).
Calling QGuiApplication::setOverrideCursor() seams not to be a practical solution as I can not "overwrite" each MouseArea to call may replaceCursor() magic-global-function. For example the change column with cursor within a TableView is currently impossible for me to manipulate.
To me the most practical solution would be to replace the appearance of all cursors but leaf Qt with the tasks to correctly choose the cursor style.
Thanks for any help!
You can still use QGuiApplication::setOverrideCursor() to decorate your mouse areas. It works like a stack, you can set and then restore cursors, so you begin with setting an initial cursor from main.cpp, and then you use an "overloaded" MouseArea which sets its cursor using setOverrideCursor() as well, instead of using the QML functionality.
For example:
onContainsMouseChanged: {
if (containsMouse) Sys.setOverrideCursor(yourCursortype)
else Sys.restoreOverrideCursor()
}
Of course, that means you will have to create an auxiliary object that will call those functions from C++, and expose it to QML so it can be called from there.
Brief description: If I create a customized LineSeries class and add that one to my project, even if it's the same as original, I lose data tip functionality.
Elaborated description:
I'm using a LineChart component and I needed to render my lines so that they change color according to some value ranges. So I modified LineRenderer, applied it to my LineSeries and everything was working great. Unfortunately I later realized that I will need to supply ranges and colors dynamically as they're supposed to be customizable. This is where it gets tricky.
This is the code I use to set my lineRenderer:
var cf:ClassFactory = new ClassFactory(myLineRenderer);
lineSeries.setStyle("lineSegmentRenderer",cf);
I did not find a way to dynamically change data on a ClassFactory without making an instance of it. But if I make an instance of it, I can not set it as a style. If anyone knows of a way to do this, it would solve my problem straight out. All I need is to set an array property inside myLineRenderer. But it makes sense to me why this can't be done.
Can I dynamically make a new Class that is a clone of myLineRederer yet has one property changed?
Can I add an argument to myLineRenderer constructor? If so, how would that work with the code above?
Anyway, since that didn't work, I figured I needed to change the data supplied to myLineRenderer. For this I created my own LineSeries that has a settable Array property that it adds to the data passed to myLineRenderer. And it works great. With one little kink. As soon as I change my LineChart series from LineSeries to myLineSeries, I can't move the mouse cursor along the line and get info on each item in the chart. I removed all the changes I made to original LineSeries, but it makes no difference. What am I missing?
Right now I'm trapped between having customizable color ranges with no data tips and non-customizable color ranges with data tips. The former is still better, but I would really need both to work or at least know why that's impossible.
Any help would be much appreciated.
Take a look at the properties property of ClassFactory
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/ClassFactory.html#properties
I think that does exactly what you need it to.
A fairly broad question I know, apologies for that!
So I have a data set that I need to represent in a flex application. It needs to be represented in 2 ways, firstly as a list of components which is done using a List component and a custom ItemRenderer as normal. Secondly, it also must be represented as 'annotations' on a diagram in 2D. Since this doesn't really fit with a List, DataGrid, Chart etc. I think I need to create a new Component to render the data. I'd like to set it up so that you can specify 'itemRenderer' and 'dataProvider' properties on the component, exactly in the same way you would for a datagrid or list. The difference here is that each item of data will have mandatory X and Y coordinates which place it within the containing component.
My initial attempts subclassed UIComponent and implemented IDataRenderer but I'm unsure what other interfaces I need to implement to make the component properly data-driven?
I've already written a simple ItemRenderer / ItemEditor which will render each item of data correctly, I just need the component that will contain these....
thanks for any help
Why not just use the spark DataGroup, which lets you put things wherever you want?
I have a DAE model that is parsed into several parts. I am able to deal with them separately, such as changing their material or colour but I am having problems adding click or hover listeners over the children.
For example, lets say I have a model of a kitty where each facial feature is a child. I want to be able to hover or click the features and have a window pop up explaining the feature.
I've tried parsing the model and adding listeners but it doesn't seem to work.
Thanks in advance!
L
Hard to pin point the problem from your description, but you could check the following:
Make sure your viewport is interactive
Make sure the material your material is interactive
Make sure the DisplayObject3D you assign the listener to is not null.
Point 3, with collada objects, you can have nested objects, make sure you add a listener to an object that has geometry, not an empty(no geometry) container. With points 1,2, both viewport and material have a Boolean property called interactive which must be set to true for mouse events.
HTH
Hy!
I'm building a top view 2D map, that it's objects are stored on the server.
The kind of objects are 10 and might be a photo, label, button, lists, mix of them or labels with tooltips.
The component must request the "areas" that are missing on screen.
An area is 1000x1000 px and is cached in flex.
To move in the map, will be like in google maps (drag-and-drop)
I should be able to have another list and move objects from one to another using drag-an-drop on objects. Ex.: I grab an objects from a list and I move it on this map, I release the mouse button and the item is placed there.
Now the problem is: I build a custom component for this trying to emulate the item renderer for performance and recyclage, implement drag-and-drop on objects and request the areas that are missing?
or
I extend the List component from spark and I add some features as multiple kind of itemrenderers and use recycle on them. Of course it must be able to request the missing areas on the screen and cache it's data.
Maybe create a custom layout is needed too.
What I need is something that must be really fluid, so the lighter this component is, the better!
Thanks for your help! (:
UPDATE:
*There will be not any object over another.
*I will not use hitTest on bitmaps because all bitmaps are wrapped in another component,as they,for now are itemrenderers.
Anyway I already begin to do this using a class that extends the SkinnableDataContainer and a custom layout. As the layout is not like a grid, is sparse, random items at diferent points(x, y).
Now I have this problem: https://stackoverflow.com/questions/4192934/how-to-get-the-localx-and-localy-relative-to-item-renderer-and-not-to-the-spark
Maybe you could use a combination of some of the following:
A canvas background (for layered components), looks fluid if using hitTest. Split up the canvas using constraintColumn/constraintRow for a grid layout.
Use hitTest (on items bitmapdata) for collision detection, and move the items to a new position (if items are dropped on top of one another).
Use a combo of mouseDown, mouseMove, mouseUP (example here) for drag n drop.
Use a 2D/3D indexed array to track the position of items (example here)