453 ^ Complex real:x imaginary:y |
453 ^ Complex real:x imaginary:y |
454 |
454 |
455 "Modified: / 9.7.1998 / 10:21:10 / cg" |
455 "Modified: / 9.7.1998 / 10:21:10 / cg" |
456 ! |
456 ! |
457 |
457 |
458 asFractionalLayout |
458 asFloat |
459 "return a LayoutOrigin from the receiver, |
459 ^ self shouldNotImplement |
460 treating the receiver coordinates as fractional parts |
460 ! |
461 (i.e. relative to superview). |
461 |
462 Notice: in 10.5.x LayoutOrigin is not yet officially released." |
462 asFraction |
463 |
463 ^ self shouldNotImplement |
464 ^ LayoutOrigin fractionalFromPoint:self |
|
465 |
|
466 " |
|
467 (0@0.5) asFractionalLayout |
|
468 (0@0.5) asLayout |
|
469 (0@10) asLayout |
|
470 (0@10) asOffsetLayout |
|
471 " |
|
472 |
|
473 ! |
464 ! |
474 |
465 |
475 asIntegerPoint |
466 asIntegerPoint |
476 (x isInteger and:[y isInteger]) ifTrue:[ ^ self]. |
467 (x isInteger and:[y isInteger]) ifTrue:[ ^ self]. |
477 ^ x asInteger @ y asInteger |
468 ^ x asInteger @ y asInteger |
478 ! |
|
479 |
|
480 asLayout |
|
481 "return a LayoutOrigin from the receiver. |
|
482 If the receiver coordinates are between 0 and 1, take |
|
483 them as fractional parts (relative to superview). |
|
484 Otherwise, treat them as absolute offsets. |
|
485 Notice: in 10.5.x LayoutOrigin is not yet released." |
|
486 |
|
487 ^ LayoutOrigin fromPoint:self |
|
488 |
|
489 " |
|
490 (0@0.5) asFractionalLayout |
|
491 (0@0.5) asLayout |
|
492 (0@10) asLayout |
|
493 (0@10) asOffsetLayout |
|
494 " |
|
495 |
|
496 ! |
|
497 |
|
498 asOffsetLayout |
|
499 "return a LayoutOrigin from the receiver, |
|
500 treating the receiver coordinates as absolute offsets. |
|
501 Notice: in 10.5.x LayoutOrigin is not yet released." |
|
502 |
|
503 ^ LayoutOrigin offsetFromPoint:self |
|
504 |
|
505 " |
|
506 (0@0.5) asFractionalLayout |
|
507 (0@0.5) asLayout |
|
508 (0@10) asLayout |
|
509 (0@10) asOffsetLayout |
|
510 " |
|
511 |
|
512 ! |
469 ! |
513 |
470 |
514 asPoint |
471 asPoint |
515 "return the receiver as Point - this is the receiver" |
472 "return the receiver as Point - this is the receiver" |
516 |
473 |
629 of the receiver." |
586 of the receiver." |
630 |
587 |
631 |offsetPoint| |
588 |offsetPoint| |
632 |
589 |
633 (anOffset isMemberOf:Point) ifTrue:[ "type hint to stc" |
590 (anOffset isMemberOf:Point) ifTrue:[ "type hint to stc" |
634 x := x + anOffset x. |
591 x := x + anOffset x. |
635 y := y + anOffset y. |
592 y := y + anOffset y. |
636 ^ self |
593 ^ self |
637 ]. |
594 ]. |
638 anOffset isNumber ifTrue:[ |
595 anOffset isNumber ifTrue:[ |
639 x := x + anOffset. |
596 x := x + anOffset. |
640 y := y + anOffset. |
597 y := y + anOffset. |
641 ^ self |
598 ^ self |
642 ]. |
599 ]. |
643 |
600 |
644 "this is the general (& clean) code ..." |
601 "this is the general (& clean) code ..." |
645 |
602 |
646 offsetPoint := anOffset asPoint. |
603 offsetPoint := anOffset asPoint. |
647 x := x + anOffset x. |
604 x := x + offsetPoint x. |
648 y := y + anOffset y |
605 y := y + offsetPoint y |
649 ! ! |
606 ! ! |
650 |
607 |
651 |
608 |
652 !Point methodsFor:'interpolating'! |
609 !Point methodsFor:'interpolating'! |
653 |
610 |