docs: annotate Foundry source and deployment lifecycle in Chinese [skip ci]
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// 子图成员拖放可附带来源画布局部坐标;此处只更新来源文档,目标坐标转换由所有权事务完成。
|
||||
package platform
|
||||
|
||||
import (
|
||||
@@ -8,11 +9,13 @@ import (
|
||||
|
||||
// Positions are expressed in the source board's local coordinates. The existing
|
||||
// ownership transaction converts them into destination coordinates exactly once.
|
||||
// memberDropPosition 必须显式携带 x/y,避免遗漏字段被当作零而让节点意外跳位。
|
||||
type memberDropPosition struct {
|
||||
X float64 `json:"x"`
|
||||
Y float64 `json:"y"`
|
||||
}
|
||||
|
||||
// validMemberDropPositions 兼容缺省坐标的旧客户端;提供时必须与成员 ID 集合完全一致且坐标有限。
|
||||
func validMemberDropPositions(ids []string, positions map[string]memberDropPosition) bool {
|
||||
if positions == nil {
|
||||
return true
|
||||
@@ -31,6 +34,7 @@ func validMemberDropPositions(ids []string, positions map[string]memberDropPosit
|
||||
return true
|
||||
}
|
||||
|
||||
// positionMemberDrop 在 JSON 节点数组中替换所有指定位置,缺节点或非法文档返回所有权错误。
|
||||
func positionMemberDrop(raw json.RawMessage, positions map[string]memberDropPosition) (json.RawMessage, error) {
|
||||
var doc map[string]any
|
||||
if err := json.Unmarshal(raw, &doc); err != nil {
|
||||
@@ -58,6 +62,7 @@ func positionMemberDrop(raw json.RawMessage, positions map[string]memberDropPosi
|
||||
return json.Marshal(doc)
|
||||
}
|
||||
|
||||
// UnmarshalJSON 只接受两个非 null 数值字段;范围与有限性由 validMemberDropPositions 继续检查。
|
||||
func (p *memberDropPosition) UnmarshalJSON(raw []byte) error {
|
||||
var fields map[string]json.RawMessage
|
||||
if err := json.Unmarshal(raw, &fields); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user