diff --git a/public/reference/data.json b/public/reference/data.json index 018570a85c..0df5e709a3 100644 --- a/public/reference/data.json +++ b/public/reference/data.json @@ -10675,7 +10675,7 @@ { "file": "src/dom/dom.js", "line": 1159, - "description": "
Creates a dropdown menu <select></select>
element.
The parameter is optional. If true
is passed, as in\nlet mySelect = createSelect(true)
, then the dropdown will support\nmultiple selections. If an existing <select></select>
element\nis passed, as in let mySelect = createSelect(otherSelect)
, the existing\nelement will be wrapped in a new p5.Element\nobject.
Dropdowns extend the p5.Element class with a few\nhelpful methods for managing options:
\nmySelect.option(name, [value])
adds an option to the menu. The first paremeter, name
, is a string that sets the option's name and value. The second parameter, value
, is optional. If provided, it sets the value that corresponds to the key name
. If an option with name
already exists, its value is changed to value
.mySelect.value()
returns the currently-selected option's value.mySelect.selected()
returns the currently-selected option.mySelect.selected(option)
selects the given option by default.mySelect.disable()
marks the whole dropdown element as disabled.mySelect.disable(option)
marks a given option as disabled.mySelect.enable()
marks the whole dropdown element as enabled.mySelect.enable(option)
marks a given option as enabled.Creates a dropdown menu <select></select>
element.
The parameter is optional. If true
is passed, as in\nlet mySelect = createSelect(true)
, then the dropdown will support\nmultiple selections. If an existing <select></select>
element\nis passed, as in let mySelect = createSelect(otherSelect)
, the existing\nelement will be wrapped in a new p5.Element\nobject.
Dropdowns extend the p5.Element class with a few\nhelpful methods for managing options:
\nmySelect.option(name, [value])
adds an option to the menu. The first parameter, name
, is a string that sets the option's name and value. The second parameter, value
, is optional. If provided, it sets the value that corresponds to the key name
. If an option with name
already exists, its value is changed to value
.mySelect.value()
returns the currently-selected option's value.mySelect.selected()
returns the currently-selected option.mySelect.selected(option)
selects the given option by default.mySelect.disable()
marks the whole dropdown element as disabled.mySelect.disable(option)
marks a given option as disabled.mySelect.enable()
marks the whole dropdown element as enabled.mySelect.enable(option)
marks a given option as enabled.Creates a radio button element.
\nThe parameter is optional. If a string is passed, as in\nlet myRadio = createSelect('food')
, then each radio option will\nhave \"food\"
as its name
parameter: <input name=\"food\"></input>
.\nIf an existing <div></div>
or <span></span>
\nelement is passed, as in let myRadio = createSelect(container)
, it will\nbecome the radio button's parent element.
Radio buttons extend the p5.Element class with a few\nhelpful methods for managing options:
\nmyRadio.option(value, [label])
adds an option to the menu. The first paremeter, value
, is a string that sets the option's value and label. The second parameter, label
, is optional. If provided, it sets the label displayed for the value
. If an option with value
already exists, its label is changed and its value is returned.myRadio.value()
returns the currently-selected option's value.myRadio.selected()
returns the currently-selected option.myRadio.selected(value)
selects the given option and returns it as an HTMLInputElement
.myRadio.disable(shouldDisable)
enables the entire radio button if true
is passed and disables it if false
is passed.Creates a radio button element.
\nThe parameter is optional. If a string is passed, as in\nlet myRadio = createSelect('food')
, then each radio option will\nhave \"food\"
as its name
parameter: <input name=\"food\"></input>
.\nIf an existing <div></div>
or <span></span>
\nelement is passed, as in let myRadio = createSelect(container)
, it will\nbecome the radio button's parent element.
Radio buttons extend the p5.Element class with a few\nhelpful methods for managing options:
\nmyRadio.option(value, [label])
adds an option to the menu. The first parameter, value
, is a string that sets the option's value and label. The second parameter, label
, is optional. If provided, it sets the label displayed for the value
. If an option with value
already exists, its label is changed and its value is returned.myRadio.value()
returns the currently-selected option's value.myRadio.selected()
returns the currently-selected option.myRadio.selected(value)
selects the given option and returns it as an HTMLInputElement
.myRadio.disable(shouldDisable)
enables the entire radio button if true
is passed and disables it if false
is passed.Draws an image to the canvas.
\nThe first parameter, img
, is the source image to be drawn. img
can be\nany of the following objects:
The second and third parameters, dx
and dy
, set the coordinates of the\ndestination image's top left corner. See\nimageMode() for other ways to position images.
Here's a diagram that explains how optional parameters work in image()
:
The fourth and fifth parameters, dw
and dh
, are optional. They set the\nthe width and height to draw the destination image. By default, image()
\ndraws the full source image at its original size.
The sixth and seventh parameters, sx
and sy
, are also optional.\nThese coordinates define the top left corner of a subsection to draw from\nthe source image.
The eighth and ninth parameters, sw
and sh
, are also optional.\nThey define the width and height of a subsection to draw from the source\nimage. By default, image()
draws the full subsection that begins at\n(sx, sy)
and extends to the edges of the source image.
The ninth parameter, fit
, is also optional. It enables a subsection of\nthe source image to be drawn without affecting its aspect ratio. If\nCONTAIN
is passed, the full subsection will appear within the destination\nrectangle. If COVER
is passed, the subsection will completely cover the\ndestination rectangle. This may have the effect of zooming into the\nsubsection.
The tenth and eleventh paremeters, xAlign
and yAlign
, are also\noptional. They determine how to align the fitted subsection. xAlign
can\nbe set to either LEFT
, RIGHT
, or CENTER
. yAlign
can be set to\neither TOP
, BOTTOM
, or CENTER
. By default, both xAlign
and yAlign
\nare set to CENTER
.
Draws an image to the canvas.
\nThe first parameter, img
, is the source image to be drawn. img
can be\nany of the following objects:
The second and third parameters, dx
and dy
, set the coordinates of the\ndestination image's top left corner. See\nimageMode() for other ways to position images.
Here's a diagram that explains how optional parameters work in image()
:
The fourth and fifth parameters, dw
and dh
, are optional. They set the\nthe width and height to draw the destination image. By default, image()
\ndraws the full source image at its original size.
The sixth and seventh parameters, sx
and sy
, are also optional.\nThese coordinates define the top left corner of a subsection to draw from\nthe source image.
The eighth and ninth parameters, sw
and sh
, are also optional.\nThey define the width and height of a subsection to draw from the source\nimage. By default, image()
draws the full subsection that begins at\n(sx, sy)
and extends to the edges of the source image.
The ninth parameter, fit
, is also optional. It enables a subsection of\nthe source image to be drawn without affecting its aspect ratio. If\nCONTAIN
is passed, the full subsection will appear within the destination\nrectangle. If COVER
is passed, the subsection will completely cover the\ndestination rectangle. This may have the effect of zooming into the\nsubsection.
The tenth and eleventh parameters, xAlign
and yAlign
, are also\noptional. They determine how to align the fitted subsection. xAlign
can\nbe set to either LEFT
, RIGHT
, or CENTER
. yAlign
can be set to\neither TOP
, BOTTOM
, or CENTER
. By default, both xAlign
and yAlign
\nare set to CENTER
.
myRadio.option(value, [label])
adds an option to the menu.
- The first paremeter, value
, is a string that sets the option's
+ The first parameter, value
, is a string that sets the option's
value and label. The second parameter, label
, is optional. If
provided, it sets the label displayed for the value
. If an option
with value
already exists, its label is changed and its value is
diff --git a/src/content/reference/en/p5/createSelect.mdx b/src/content/reference/en/p5/createSelect.mdx
index ebe2047ebb..661e493e37 100644
--- a/src/content/reference/en/p5/createSelect.mdx
+++ b/src/content/reference/en/p5/createSelect.mdx
@@ -28,7 +28,7 @@ description: >
mySelect.option(name, [value])
adds an option to the menu.
- The first paremeter, name
, is a string that sets the option's
+ The first parameter, name
, is a string that sets the option's
name and value. The second parameter, value
, is optional. If
provided, it sets the value that corresponds to the key name
. If
an option with name
already exists, its value is changed to
diff --git a/src/content/reference/en/p5/image.mdx b/src/content/reference/en/p5/image.mdx
index 193bc3d4c2..f59fec88d3 100644
--- a/src/content/reference/en/p5/image.mdx
+++ b/src/content/reference/en/p5/image.mdx
@@ -79,7 +79,7 @@ description: >
subsection.
- The tenth and eleventh paremeters, xAlign
and
+
The tenth and eleventh parameters, xAlign
and
yAlign
, are also
optional. They determine how to align the fitted subsection.
diff --git a/src/content/reference/ko/p5/p5.Image.mdx b/src/content/reference/ko/p5/p5.Image.mdx
index 406537cb5c..ecb6eb2220 100644
--- a/src/content/reference/ko/p5/p5.Image.mdx
+++ b/src/content/reference/ko/p5/p5.Image.mdx
@@ -124,7 +124,7 @@ methods:
img.set()를 호출하여 이루어질 수 있습니다.
선택적 매개변수(paremeter)인 x
, y
, width
, height
는
+
선택적 매개변수(parameter)인 x
, y
, width
, height
는
업데이트할 p5.Image 객체의 하위 섹션(subsection)을 정의합니다.