Element Drag > Location Reset Issues


#1

Hi to All!

I ran into a phenomenon that I do not understand while working on this problem for @sjdaniels :



Note: Steven was using a symbol with innerHTML, I stripped it down to just two elements (then grouped - no innerHTML) in the following examples. The results were the same, symbol or grouped element.

My solution had two variations:
First, jQuery - since that is what Steven is using.


$("#rectLoc").css({"left":"100px", "top":"100px"});

Moves the grouped element back to original location.


It worked but had very strange second drag effect > clicking on the grouped element again made it jump to the location where the drag of the grouped element finished after the first drag.


Next I tried:
var reSet = hypeDocument.getElementById('rectLoc');
hypeDocument.setElementProperty(reSet, 'left', '100');
hypeDocument.setElementProperty(reSet, 'top', '100');

Also resulting in unexpected behavior: after the grouped element was reset into place, and then another (attempted) drag, it flies off the page.


I've tried with/without "Position with CSS left/top". Ditto "Use Webkit graphics acceleration" just in case these settings had an impact - made no difference - what ever the settings same behaviors ensued.

Here’s the Project containing both code approaches: TitleBarReset_v2.hype.zip (17.6 KB)

These behaviors strike me as buggy.


Need Help - Centering an Element On Click
(Mark Hunte) #2

That does look like a bug.

I notice that if I then go to the element in the web inspector and change one of it’s properties it comes back.
It is like it is getting overlooked by the redraw rather than flying off !


(Mark Hunte) #3

I can get it to work using a timeline ( keyframes set to instant)

TitleBarResetvMH.hype.zip (16.2 KB)

But it would be good to get this fixed properly


Need Help - Centering an Element On Click
#4

Do not put the value in quotes :wink: you are setting it as text rather than an integer :slight_smile: if you drag the element the second time then effectively the position becomes “100” and from then on “1001, 1002, etc” hence the disappearance.

I admit that perhaps this can be accounted for in the API by perhaps making sure whatever is put in the value spot is always a number or better error handling


(Mark Hunte) #5

Doh, cannot believe I did not spot that… :open_mouth:


#6

@DBear - Excellent - Thank You! Now I can sleep tonight ;->

@MarkHunte - Thanks for checking it out.