Skip to content
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

hotspot feature #7

Closed
alann-maulana opened this issue Jan 26, 2014 · 10 comments
Closed

hotspot feature #7

alann-maulana opened this issue Jan 26, 2014 · 10 comments

Comments

@alann-maulana
Copy link

Thanks for your great code. It would be great if it has hotspot feature 👍

@paweljankowski
Copy link

Is it possible to add hot spots (eg. arrows) for chaning sphere texture?

@ivoheckmann
Copy link

Hotspot support would be great.

@mayakraft
Copy link
Owner

thanks guys! if I'm reading correctly, you are talking about hotspot on the screen, not hotspot in the 3D environment, correct? the latter, which is much harder, i'm working on right now, maybe finish inside of a month.

RE screen hotspot: consider PanoramaView as a kind of a UIImageView class, one could add a UIButton on top of it in the view hierarchy, and it intercepts touches just fine. So you can do all this in ViewController without touching PanoramaView. Here's what i just tried in ViewDidLoad right after [self setView:panoramaView]:

    float buttonSize = 88.0f;
    UIButton *hotspot = [[UIButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width*.5-buttonSize*.5, self.view.bounds.size.height-buttonSize, buttonSize, buttonSize)];
    [hotspot addTarget:self action:@selector(changeImage:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:hotspot];

and then added this function below:

-(void) changeImage:(UIButton*)sender{
    NSLog(@"change Image");
    [panoramaView setTexture:@"newImage.png"];
}

Does this work in the context of your code?

@ivoheckmann
Copy link

Hi @robbykraft,

thanks for your answer (and for the great code of course). I was talking about hotspots in the 3d env. - but cool to hear your are working on it. I can imagine the it's not that simple - thinking of touch detection and trigger actions.

@kazzar
Copy link

kazzar commented Mar 10, 2014

Grate work @robbykraft , unfortunately my english is very bad :P
There is a way to get image coordinate during pan gesture? i want to try to intercept when 1 frame is displayed and show a button like you have suggest

@mayakraft
Copy link
Owner

hi all, check the latest commit, the touchVector is calculated as it should. how does this suffice for hotspots?
i still need to precision test the getPixel function, and the graphical line indicators that are triggered by a tapGesture. they do seem to be in the right place.

@ivoheckmann
Copy link

Hi @robbykraft ...thanks again for your work. Talking of hotspots for me the first question is how to add touchable hotsport views in the environment, the second one how to trigger actions (wich i guess can be done via the commits you have done).

@mayakraft
Copy link
Owner

thanks for the reply! that makes sense. lemme know if this function helps out:
-(bool)touchInRect:(CGRect)
sorry if i closed this too early!

@phantomlight
Copy link

Hello robbykraft thank you so much for this! works great in my app. I'm trying to get hotspots to work. Not sure if anyone was able to get it working. Pretty much added a button and when the button is pressed depending on the coordinates set should change the view inside the image. Any idea?

@mayakraft
Copy link
Owner

hello @phantomlight
did you try this function:

/**
 * Hit-detection for all active touches
 *
 * @param CGRect defined in image pixel coordinates
 * @return YES if touch is inside CGRect, NO otherwise
 */
-(BOOL) touchInRect:(CGRect)rect;

This adds a button into the world. This is the function that people are calling a "hotspot". It moves with the panorama.

Adding a UIKit UIButton will not move around with the world, but sit in the same location on the screen.

Can you clarify again what you're trying to accomplish?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants