CSS Graphics Geometry
Guide
Reference
GitHub
Guide
Reference
GitHub
  • Part 0. Math foundations

    • 좌표계와 CSS pixel
    • 점, 벡터, 거리와 기본 용어
    • 각도, 라디안, atan2
  • Part 1. Transform linear algebra

    • translate, scale, rotate
    • CSS matrix(a,b,c,d,e,f)
    • 변환 순서와 transform-origin
    • local, world, screen 좌표계
    • inverse matrix와 포인터 입력
    • 좌표와 transform 디버깅
  • Part 2. Infinite canvas math and architecture

    • viewport와 camera 모델
    • cursor anchored zoom
    • ruler와 tick 계산
    • 주기 함수와 grid step
    • content, overlay, controls layer
    • scene graph와 nested transform
  • Part 3. Editor tool math

    • Pointer Events와 드래그
    • DOMRect와 getBoundingClientRect
    • hit testing과 bounding box
    • selection rectangle과 marquee
    • selection bounds와 handles
    • resize와 rotation handle
    • snapping과 smart guides
    • group, frame, clipping
  • Part 4. CSS graphics properties as math

    • CSS box로 도형 만들기
    • clip-path, radius, shadow
    • 선형보간과 linear-gradient
    • 거리 함수와 radial/conic-gradient
    • stacking context와 합성
    • layout, paint, composite
  • Part 5. Editor state and persistence

    • 레이어 모델과 z-index
    • 이동, 복제, 삭제, 잠금
    • undo/redo command model
    • JSON export/import
  • Part 6. SVG overlay and vector editing

    • SVG viewBox와 좌표계
    • getScreenCTM과 inverse
    • SVG pointer-events와 stroke hit testing
    • cubic bezier path editing
    • mask, clipPath, marker
  • Part 7. Figma to CSS translation

    • Figma node와 CSS DOM 모델
    • Frame constraints와 Auto Layout
    • Fills, strokes, effects를 CSS로
    • Vector와 text 변환
    • gradient 밖의 CSS 수학
    • Figma gradient를 CSS gradient로 변환하기
    • 수학이 필요한 Figma to CSS 속성들
    • Figma VectorNetwork 정리
  • Appendix A. Canvas renderer transition

    • Canvas로 넘어가는 기준
  • Appendix B. Motion and timing

    • 모션 수학과 timing 함수
    • Keyframe timeline 엔진
    • Motion path 수학
    • Bezier curve 길이 구하기

selection bounds와 handles

이번에는 선택된 오브젝트 주변에 나타나는 파란 박스와 핸들입니다.

사용자는 이 UI를 보고 “아, 이게 선택됐구나” 하고 이해합니다. 그리고 corner handle을 잡고 resize하거나, 위쪽 rotation handle을 잡고 회전합니다.

즉 selection overlay는 단순한 장식이 아니라 편집 동작의 입구입니다.

selection bounds는 합집합이다

bounds = union(AABB_i)
selection bounds and fixed screen handles diagramcontent layer: world transformsbounds = union(AABB_i), handle size = 8 screen px
selection overlay는 content가 아니라 tool UI입니다. 위치는 bounds에서 오지만 handle 크기는 screen px로 유지합니다.

선택된 오브젝트가 하나라면 그 오브젝트의 bounds가 selection bounds입니다. 여러 개라면 각 오브젝트의 transformed corner를 모아 min/max를 구합니다.

corner handles = (left, top), (right, top), ...
edge handles = midpoint(edge)

corner에는 resize handle, edge 중간에는 한 축 resize handle을 배치할 수 있습니다. rotation handle은 보통 bounds 위쪽으로 일정 screen 거리만큼 떨어뜨려 둡니다.

handle은 screen 크기로 그린다

handle이 content layer 안에 들어가서 같이 zoom되면, zoom out에서 너무 작아지고 zoom in에서 너무 커집니다. 그래서 overlay에 screen pixel 크기로 그리는 편이 안정적입니다.

handle size = 8 screen px
handle position = project(world bounds point)

위치는 world bounds를 screen으로 투영해 정하고, 크기는 screen 기준으로 유지합니다. 이 둘을 구분하면 핸들이 훨씬 얌전합니다.

대상마다 handle 세트가 다르다

사각형, 텍스트, path, frame은 모두 다른 편집 핸들을 가질 수 있습니다. 같은 selection overlay 구조 위에 대상별 handle set을 얹는 방식이 좋습니다.

데모에서 볼 것

데모에서는 여러 도형을 선택했을 때 bounds가 각 도형의 어떤 점을 포함하는지 확인합니다.

오늘의 핵심은 selection overlay를 content가 아니라 도구 UI로 보는 것입니다. 오브젝트는 world에 있고, 핸들은 화면에서 잡기 좋아야 합니다.

Edit this page
최근 수정: 26. 5. 14. PM 5:45
Contributors: easylogic
Prev
selection rectangle과 marquee
Next
resize와 rotation handle