mouse movement over buttons fixed

This commit is contained in:
Jindra Pet��k
2014-03-15 12:06:21 +01:00
parent 6a8844440c
commit 86e6b9df38
4 changed files with 133 additions and 97 deletions
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.exporters.Matrix;
import com.jpexs.decompiler.flash.tags.DoActionTag;
import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag;
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
import com.jpexs.decompiler.flash.tags.StartSound2Tag;
import com.jpexs.decompiler.flash.tags.StartSoundTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
@@ -84,6 +85,9 @@ public class Timeline {
if (t instanceof StartSoundTag) {
frame.sounds.add(((StartSoundTag) t).soundId);
}
if (t instanceof StartSound2Tag) {
frame.soundClasses.add(((StartSound2Tag) t).soundClassName);
}
if (t instanceof SetBackgroundColorTag) {
frame.backgroundColor = ((SetBackgroundColorTag) t).backgroundColor;
}
@@ -179,16 +183,16 @@ public class Timeline {
}
public List<Integer> getSounds(int frame,int time, DepthState stateUnderCursor, int mouseButton) {
List<Integer> ret = new ArrayList<>();
public void getSounds(int frame, int time, DepthState stateUnderCursor, int mouseButton, List<Integer> sounds, List<String> soundClasses) {
Frame fr = this.frames.get(frame);
ret.addAll(fr.sounds);
sounds.addAll(fr.sounds);
soundClasses.addAll(fr.soundClasses);
for (int d = this.getMaxDepth(); d >= 0; d--) {
DepthState ds = fr.layers.get(d);
if (ds != null) {
CharacterTag c = swf.characters.get(ds.characterId);
if (c instanceof Timelined) {
int dframe = (time+ds.time) % ((Timelined) c).getTimeline().frames.size();
int dframe = (time + ds.time) % ((Timelined) c).getTimeline().frames.size();
if (c instanceof ButtonTag) {
ButtonTag bt = (ButtonTag) c;
dframe = ButtonTag.FRAME_UP;
@@ -200,11 +204,10 @@ public class Timeline {
}
}
}
ret.addAll(((Timelined) c).getTimeline().getSounds(dframe,time+ds.time, stateUnderCursor, mouseButton));
((Timelined) c).getTimeline().getSounds(dframe, time + ds.time, stateUnderCursor, mouseButton, sounds, soundClasses);
}
}
}
return ret;
}
public void getObjectsOutlines(int frame, int time, int ratio, DepthState stateUnderCursor, int mouseButton, Matrix transformation, List<DepthState> objs, List<Shape> outlines) {
@@ -238,17 +241,18 @@ public class Timeline {
dframe = ds.time % ((Timelined) c).getTimeline().frames.size();
if (c instanceof ButtonTag) {
ButtonTag bt = (ButtonTag) c;
dframe = ButtonTag.FRAME_UP;
if (stateUnderCursor == ds) {
if (mouseButton > 0) {
dframe = ButtonTag.FRAME_DOWN;
} else {
dframe = ButtonTag.FRAME_OVER;
}
}
dframe = ButtonTag.FRAME_HITTEST;
/*dframe = ButtonTag.FRAME_UP;
if (stateUnderCursor == ds) {
if (mouseButton > 0) {
dframe = ButtonTag.FRAME_DOWN;
} else {
dframe = ButtonTag.FRAME_OVER;
}
}*/
}
}
Shape cshape = ((DrawableTag) c).getOutline(dframe, ds.time+time, ds.ratio, stateUnderCursor, mouseButton, m);
Shape cshape = ((DrawableTag) c).getOutline(dframe, ds.time + time, ds.ratio, stateUnderCursor, mouseButton, m);
Area addArea = new Area(cshape);
if (currentClip != null) {
@@ -264,7 +268,7 @@ public class Timeline {
outlines.add(addArea);
}
if (c instanceof Timelined) {
((Timelined) c).getTimeline().getObjectsOutlines(dframe,time+ds.time,ds.ratio, stateUnderCursor, mouseButton, m, objs, outlines);
((Timelined) c).getTimeline().getObjectsOutlines(dframe, time + ds.time, ds.ratio, stateUnderCursor, mouseButton, m, objs, outlines);
}
}
}
@@ -299,7 +303,7 @@ public class Timeline {
int dframe = 0;
if (c instanceof Timelined) {
dframe = (time+ds.time) % ((Timelined) c).getTimeline().frames.size();
dframe = (time + ds.time) % ((Timelined) c).getTimeline().frames.size();
if (c instanceof ButtonTag) {
ButtonTag bt = (ButtonTag) c;
dframe = ButtonTag.FRAME_UP;
@@ -312,7 +316,7 @@ public class Timeline {
}
}
}
Shape cshape = ((DrawableTag) c).getOutline(dframe, time+ds.time,ds.ratio, stateUnderCursor, mouseButton, m);
Shape cshape = ((DrawableTag) c).getOutline(dframe, time + ds.time, ds.ratio, stateUnderCursor, mouseButton, m);
Area addArea = new Area(cshape);
if (currentClip != null) {