9 patch has broken cords

Bugs will be moved here once resolved.

Post » Tue Jan 27, 2015 3:12 pm

Problem Description
Can not find the X and Y of the 9 patch... System cant seem to find it either.
In the enclosed file I made it try to place the 9 patch where ever there is a Hold or right-click.

System only seems to return 0,0 as the 9patch cords.

Attach a Capx
Broken9Pathch cords.capx


Description of Capx
Rightclick or do a hold gesture to make system spawn 9patch... it should be at touch.x and touch.y... it will probably add the 9 patch to the top left corner. (0,0)
Steps to Reproduce Bug
[list]
load capx
run capX
rightclick anywhere

Observed Result
9patch draws at 0,0

Expected Result
patch to draw at 0,0
Affected Browsers
[list]
[*] Chrome: (YES)
[*] NodeWebkit: (YES)


Operating System and Service Pack
Win 7 Current SP (auto update is on)

Construct 2 Version ID
195 , the current stable release

Other

Thanks in advance.
You do not have the required permissions to view the files attached to this post.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Tue Jan 27, 2015 3:44 pm

I believe it is a problem with your events. I downloaded the example, ran it and got the result you did. I then removed the event and recreated it with just a mouse click setting the 9 patch to the mouse location. It worked just fine. I then changed it to a Touch event and used the Touch coordinates. Again, it worked just fine.

You can see this is the case simply by disabling the two conditions for the second event and using a simple On Any Touch Start event.

See the attached modified .capx.

I will say, you are using a Touch and a Mouse event to control the same action. This can cause a problem because, when the mouse event triggers, there are no Touch coordinates so the 9 patch would be placed at position 0, 0. Since you are using the Touch coordinates to set the position of the new 9 patch object, this is probably what is causing your event to produce a wrong result. The On Hold Gesture Over event doesn't appear to do anything.
You do not have the required permissions to view the files attached to this post.
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Tue Jan 27, 2015 5:34 pm

FragFather wrote: you are using a Touch and a Mouse event to control the same action. This can cause a problem because, when the mouse event triggers, there are no Touch coordinates so the 9 patch would be placed at position 0, 0. Since you are using the Touch coordinates to set the position of the new 9 patch object, this is probably what is causing your event to produce a wrong result.


Thanks so much. I never knew that we could not mix and match them :),

I will do some sort of mouse or touch detection at start-up so I do not use a touch and a mouse sensor running at the same time.

Thanks again FragFather!
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Tue Jan 27, 2015 6:28 pm

Closing as not a bug: you retrieve the Touch object co-ordinates in a mouse event. These are separate. In a mouse event you need to use Mouse.X/Y and in a touch event you need to use Touch.X/Y.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240

Post » Tue Jan 27, 2015 8:10 pm

Thanks Ashley!

Sorry about the mixup :)
B
29
S
8
G
4
Posts: 767
Reputation: 5,985


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests