Mercurial > MadButterfly
comparison pyink/frameline.py @ 1215:8e372ae69010
Fix the issue of showing active mark for a frame in a tween
- Does not show active frame if user set an active frame in a tween
and move the to other frame.
- Frameline only redraw active mark of the current active frame is
same as one of new hover and last hover frame.
- It is fixed by detecting if the crruent active frame is in the same
frame as one of new hover and last hover frame.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 05 Jan 2011 18:53:54 +0800 |
parents | e55499f7505a |
children | 93acb8568ad3 |
comparison
equal
deleted
inserted
replaced
1214:e55499f7505a | 1215:8e372ae69010 |
---|---|
426 pass | 426 pass |
427 | 427 |
428 def _draw_hover_frame(self, frame_idx): | 428 def _draw_hover_frame(self, frame_idx): |
429 if not self._drawing: | 429 if not self._drawing: |
430 return | 430 return |
431 | 431 |
432 if self._last_hover != -1: | 432 last_hover = self._last_hover |
433 self._draw_frame(self._last_hover) | 433 |
434 if self._last_hover == self._active_frame: | 434 if last_hover != -1: |
435 self._draw_active_frame() | 435 self._draw_frame(last_hover) |
436 pass | |
437 pass | 436 pass |
438 | 437 |
439 if frame_idx < self._num_frames and frame_idx >= 0: | 438 if frame_idx < self._num_frames and frame_idx >= 0: |
440 self._draw_hover(frame_idx) | 439 self._draw_hover(frame_idx) |
441 if self._last_hover == self._active_frame: | |
442 self._draw_active_frame() | |
443 pass | |
444 self._last_hover = frame_idx | 440 self._last_hover = frame_idx |
445 else: | 441 else: |
446 self._last_hover = -1 | 442 self._last_hover = -1 |
443 pass | |
444 | |
445 # | |
446 # Redraw active frame if active frame in a tween that is same as the | |
447 # one that the give frame or last hover frame is in. | |
448 # | |
449 if self._active_frame in (frame_idx, last_hover): | |
450 self._draw_active_frame() | |
451 return | |
452 | |
453 for idx in (frame_idx, last_hover): | |
454 key_pos = self._find_keyframe_floor(idx) | |
455 if key_pos != -1: | |
456 key = self._keys[key_pos] | |
457 if key.right_tween or \ | |
458 (key.left_tween and key.idx == idx): | |
459 # The given frame is in a tween | |
460 first_pos, last_pos = self._find_tween_range(key_pos) | |
461 start = self._keys[first_pos].idx | |
462 end = self._keys[last_pos].idx | |
463 if self._active_frame >= start and \ | |
464 self._active_frame <= end: | |
465 # The active frame is in the tween | |
466 self._draw_active_frame() | |
467 break | |
468 pass | |
469 pass | |
447 pass | 470 pass |
448 pass | 471 pass |
449 | 472 |
450 ## \brief Start future drawing actions | 473 ## \brief Start future drawing actions |
451 # | 474 # |