← 수업 제작 도구
홈 › Components › Sketch (그림판) › 화면 33

화면 33. Sketch.pointLabel [sink]

원본: Computation Layer 문서(Sketch (그림판)) · Try It (원본 화면)

화면 번호33 / 34
문서 항목 설명 (원문)pointLabelidentifier: string If the sketch has a graph background, sets a label for a point on the graph. This only works for points defined like A=(1,2), and the identifier needs to match the name given to the point (A in this case). Takes a string. The label next to the point exactly matches the provided string, so the label is turned off if the empty string is provided.

1. 화면 캡처 (빨간 번호 = 아래 표의 번호)

화면 33 캡처

화면에 적힌 영어 문구(원문):

2. CL이 입력된 곳

코드 안의 회색 줄은 원문 영어 주석이고, 파란 줄은 그 영어 주석의 번역이며, 연분홍 줄은 코드가 하는 일의 설명이다.

번호이름종류CL 코드 원문, 번역, 설명
1레이블 없는 그림판그림판
# This code sets the labels of two points
# "A" and "B" in the sketch.
▷ 이 코드는 그림판의 두 점 "A"와 "B"의 라벨을 정한다.

# When column 1 is blank, show "A" to identify the figure.
# Once a student enters text, show that text.
▷ 1열이 비어 있으면 도형을 구별하도록 "A"를 보여 준다. 학생이 글을 입력하면 그 글을 보여 준다.
pointLabel("A"): 
  when isBlank(table1.cellContent(1,1)) "A" 
  otherwise table1.cellContent(1,1) 
▶ 점 A의 라벨(pointLabel("A"))은 표 table1의 1행 1열 셀이 비어 있으면 "A", 아니면 그 셀의 내용으로 한다.
pointLabel("이름")은 그래프 배경이 있는 그림판에서 점의 라벨 글자를 정하며, A=(1,2)처럼 정의된 점에만 적용되고 이름이 점의 이름과 같아야 하고 빈 글자를 주면 라벨이 꺼진다. isBlank(…)는 글자를 받아 빈 글자인지를 참 또는 거짓으로 돌려준다. cellContent(행, 열)은 행 번호와 열 번호로 셀의 내용을 가져오며, 행 번호 1은 머리글 바로 아래 첫 행이다. when은 조건을 차례로 확인해 처음 맞는 값을 쓴다.
# when column 2 is blank, show "B" to identify the figure. # Once a student enters text, show that text. ▷ 2열이 비어 있으면 도형을 구별하도록 "B"를 보여 준다. 학생이 글을 입력하면 그 글을 보여 준다. pointLabel("B"): when isBlank(table1.cellContent(1,2)) "B" otherwise table1.cellContent(1,2) ▶ 점 B의 라벨(pointLabel("B"))은 표 table1의 1행 2열 셀이 비어 있으면 "B", 아니면 그 셀의 내용으로 한다.