Issue related to draggable content in famo.us - famo.us

I have small application in famo.us framework. There are 5 images. I want drag images. requirement is like when i drag firstImage, second image should be visible behind the first image. i tried to show second image on dragging up of firstImage, but it hides firstimage.
so is it possible to show second image behind the first image ??
Thanks

Check the z position of your images. Chances are you're encountering z-fighting, where two elements exist on the same position on the same z-axis. Try changing the z-index of the images to different values first to see if that fixes it.
Otherwise, check the 3d-transform you've supplied to famous to make sure your images aren't resting on the same z-value.

Related

MITK Segmentation draw Rectangle

I have to segment a few things in a dataset I have (.nrrd-file) by drawing a rectangle around the area of interest and saving the segments (also as .nrrd-files).
I tried everything in the Segmentation-Tool that comes with MITK but I cannot seem to find a way to draw rectangles. I also tried to do some key combos (like holding shift, ctrl or alt) while drawing but in vain.
I know I can use the Measurement-Tool to select rectangles and save them (as .pf-files), but using that I'd have to write a some code to convert those selected rectangles into rectangle segmentations later on.
Does anyone know whether there's a possibility (that I didnt find yet) to draw rectangles in the Segmentation tool, or some other way so there's no need to write a workaround?
You can use the Image Cropper plugin in MITK 2016.11 for rectangular image masking and cropping (scissors icon).
Open the plugin, select your image in the Data Manager and click on the New button in the plugin to create a bounding object. You can modify the rectangular bounding shape in the render windows by dragging its red handles. You can move the whole shape by hovering over the bounding shape (it will turn green), click, and than drag.
Click on the Mask button if you want to get an image with the same dimensions in which all pixels outside the bounding shape are set to a user defined value (see the Advanced settings in the plugin). Click on the Crop button otherwise.
Note that you can always press F1 in any active MITK plugin to open a help page with detailed instructions.

codename one - no way to set background image in list

I am new to codename one and I have tried for one and half day to fix my issue of,
a list with background image in each row.
Let me explain, I am having a list with some items(entries), I created renderer and name it appropriately. I set background correctly which is reflecting in designer (see image)
but when I run it on simulator/device , all formatting and designs are just invisible..!! (see red arrow pointing to simulator in image)
anyone have any idea ? why this is happening ?
Thanks,
Akash
It seems you didn't set the background correctly in the designer. Since the list items in the model within the designer are strings the renderer entries don't get overriden and so you see a separate UI.
To reproduce the issue in the designer click the items entry in the list property, remove everything and add a sample key/value hashtable pair. You would see all your design entries disappearing.
This might help you understand how to customize images and backgrounds here: http://www.codenameone.com/3/post/2013/12/deeper-in-the-renderer.html

Change image according to touch dragged

this one is my sprite sheet i want to change the image according to user moves his finger on the screen
i.e, when he is touches the finger near this bow which is displayed initially no2 image from sprite sheet must be displayed, as he goes on dragging his finger according images must be displayed on screen
can anyone please guide me on this scenario because i totally don't know from where i must start.
thanks in advance
this is how i am displaying first image from sprite sheet
danceSheet = [CCSpriteBatchNode batchNodeWithFile:#"bowspritesheet.png"];
[self addChild:danceSheet z:1];
danceSprite = [CCSprite spriteWithTexture:danceSheet.texture rect:CGRectMake(0, 0, 90, 140)];
danceSprite.rotation=-90;
danceSprite.position=ccp(screenSize.width/1.2, screenSize.height/6);
[danceSheet addChild:danceSprite z:0];
Here you have to make one variable that tells you that is the maximum distance user can stretch. Beyond that if he stretch , there will be no effect on the bow. Suppose that distance as 30 pixels.
Now you can implement your functionality using cctouchbegun method and cctouchmoved method. In cctouch method you have to set one ccpoint variable which will store the first location user touched. Suppose that as firstLocation. Simultaneously, you change the sprite of your bow to no.2 image.
Now, you have to work in ccmoved function. In that as user moved his fingure you will get current position where user has touched right now. So you have to get the distance and devide it by (30/10) that is 3. Suppose (your distance/3)= 1 then you don't need to change the image of the bow. Now if it is equal to 2 then you have to change the bow wiht no.(2+1=)3 image. SO From this way you can implement bow functionality.Here we did (30/10) because you have set maximum distance user can stretch is equal to 30 and you have 10 different image of bow with arrow.
Hope, you get this,.If you find any difficulty in implementing this you can as me.
I think you want some arrow animation using this given sprite-sheet, and you might want like when you swipe backwards from middle of your bow weapon then you want to launch your arrow. Right ?! you can use this sprite-sheet ,i guess what you have to do is just calculate or assume some distance. and as i am showing your this sprite-sheet , you have around 10 images for launching arrow action. so what you have to do is just put all those images at some equal distance according to your touch location ... i.e if you have 30px distance then you can put all your images according to your touch at 3px position. means you will start with your initial image at 0px & then put all other images at 0 -3 -6 -9 & so on.. so this way you might achieve this. I hope my this try help you .. ask me if you don't get my answer at any point.

Avoid truncation of Labels in a ListView

folks!
I use a listview (Icon mode) to display items which consist of an image and a label.
As you can see in the shots the row height is variable on y depending on the label length. The problem is that I want the complete labels to be drawn, but they are automatically shrinked into two lines:
The strange thing about it is that once you select an item the whole label will be shown:
This is also the case when deselecting the item, but when another item gets selected, only that one will be shown completely.
Is there a way (without drawing the text manually) to avoid truncation in my case?
If some code is needed to answer this question, don't hesitate to ask.
Greetings,
Satara
I'm guessing this was a design choice: make things look less cluttered. E.g. picture your desktop with all labels shown completely... will look messy in my case.
However, you can fix this by drawing the label yourself. Have a look into custom draw which is a service provided by the list control. The thing is that it's usually an all or nothing approach, so this will likely require you to draw everything yourself: border, image, label, etc. The other option is to get hacky: subclass the window and draw the labels again after Windows did in response to several messages (unfortunately Windows does not restrict the painting to WM_PAINT, an optimization that is a left-over from the old days...)

Question regarding image tiling in a QGraphicsView

This is related to one of my other questions.
If I am tiling a large image by creating a separate QGraphicsItem (with the raster data as its pixmap), how do I keep track of the QGraphicsItem's position within the scene? Obviously for raster data, it is important to keep all the tiles "touching" to make a continuous image and they also have to be in the right place so the image doesnt look jumbled.
Does each tile have to have positioning methods that move it in relation to it's neighbors on the top/left/bottom/right? This seems kind of clunky. Is there a better way to make them all move together?
In other words, if I pan the scene with scroll bars, or pick up the image and drag/move it around in the scene, I want all the tiles to also move and stay in the right position relative to each other.
What is the best approach for controlling the layout, which tiles need to be rendered (i.e. only the visible ones), and populating the data only once it is needed? Also, once a tile has been rendered, is the data from it ever dropped, and repopulated from the image file, say if it stays out of view for a while, then comes back later if someone pans to that section?
There are (more than) 2 ways of doing this:
Use QGraphicsItemGroup which
handles grouping of your tile items
for you. It moves, selects, updates
it's group members as if they are
one. I've never used it but from the
doc, it seems to work with typical
applications.
Paint the tiles yourself in the
paint() of one custom item. This
gives you total control on how to
place and draw the tiles while the
item truly acts as one item since it
is, well, one item. This is what I
do.