POS 在 Trello API 中的实际含义是什么 [英] What does the POS actually mean in the Trello API
问题描述
我正在使用 dillenmeisters Trello.Net API Wrapper,并且在每个 Card
上它都有一个 POS
属性.我认为这是为了它在列表中的位置,但数字似乎是任意的,从 4 到 5 位数字不等.无论如何,是否有足够的意义在列表中已经存在的另外两个之间放置"一个新的Card
?
I'm using dillenmeisters Trello.Net API Wrapper, and on each Card
it has a POS
attribute. I thought that was for position in the list that it was in, but the numbers seem arbitrary, ranging from 4 to 5 digit numbers. Is there anyway to make sense of these enough to "place" a new Card
between 2 others that already exist in the list?
推荐答案
在 Trello.NET 的 0.5.9-beta1 版本中可用(在 NuGet 上):
Available in version 0.5.9-beta1 of Trello.NET (on NuGet):
// Ways to set the position of a card
trello.Cards.ChangePos(card, 1234)
trello.Cards.ChangePos(card, Position.Top)
trello.Cards.ChangePos(card, Position.Bottom)
我没有深入研究 pos 的工作原理,但我认为这是一个排序顺序.如果你想在另外两张牌之间移动一张牌,你可以得到这两张牌的位置并将它们的位置相加并除以二.
I haven't dug deeply into how pos works, but I think it's a sort order. If you want to move a card between two other cards, you could get the position of those two cards and add their Pos together and divide by two.
例如,如果您想在卡 A 和卡 B 之间插入卡 C:
For example, if you want to insert Card C between Card A and Card B:
- 卡片 A - 位置 16
- 卡片 B - 位置 32
- 卡片 C - 位置 64
(16 + 32)/2 = 24.将 Card C Pos 设置为 24.
(16 + 32) / 2 = 24. Set Card C Pos to 24.
- 卡片 A - 位置 16
- 卡片 C - 位置 24
- 卡片 B - 位置 32
我认为他们这样做是为了在卡片移动时他们只需要更新一个 Pos(而不是它之后所有卡片的 Pos,如果他们使用没有间隙的连续 Pos,这将是必要的).
I think they do this so that they only have to update ONE Pos when a card is moved (instead of the Pos of all cards after it which would be necessary if they used a sequential Pos with no gaps).
这篇关于POS 在 Trello API 中的实际含义是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!