Browse Source

Merge pull request #887 in BA/design from ~YAOH.WU/design_0407:dev to dev

* commit 'f60f40fbdb95ed72633f5e9763f82f5870231380':
  当历史颜色少于3个时显示异常的问题
master
superman 8 years ago
parent
commit
447869a889
  1. 8
      designer_base/src/com/fr/design/style/color/UsedColorPane.java

8
designer_base/src/com/fr/design/style/color/UsedColorPane.java

@ -42,7 +42,7 @@ public class UsedColorPane extends BasicPane {
* @param rows * @param rows
* @param columns * @param columns
* @param reserveCells 留白的单元格个数 * @param reserveCells 留白的单元格个数
* @param colors 最近使用的颜色 * @param selectable
* @param needPickColorButton 是否需要加上取色器按钮 * @param needPickColorButton 是否需要加上取色器按钮
* @param setColorRealTime 取色器是否实时设定颜色 * @param setColorRealTime 取色器是否实时设定颜色
*/ */
@ -68,7 +68,6 @@ public class UsedColorPane extends BasicPane {
//最近使用颜色 //最近使用颜色
Color[] colors = ColorSelectConfigManager.getInstance().getColors(); Color[] colors = ColorSelectConfigManager.getInstance().getColors();
int size = colors.length; int size = colors.length;
int i = 0; int i = 0;
if (needPickColorButton) { if (needPickColorButton) {
// 取色按钮 // 取色按钮
@ -84,7 +83,8 @@ public class UsedColorPane extends BasicPane {
i++; i++;
} }
while (i < total) { while (i < total) {
Color color = i < size ? colors[size - (i - this.reserveCells) - 1] : DEFAULT_COLOR; Color color = i - this.reserveCells < size ? colors[size - (i - this.reserveCells) - 1] :
DEFAULT_COLOR;
panel.add(new ColorCell(color == null ? DEFAULT_COLOR : color, selectable)); panel.add(new ColorCell(color == null ? DEFAULT_COLOR : color, selectable));
i++; i++;
} }
@ -100,7 +100,7 @@ public class UsedColorPane extends BasicPane {
int size = colors.length; int size = colors.length;
for (int i = this.reserveCells; i < total; i++) { for (int i = this.reserveCells; i < total; i++) {
ColorCell cell = (ColorCell) this.pane.getComponent(i); ColorCell cell = (ColorCell) this.pane.getComponent(i);
Color color = i < size ? colors[size - (i - this.reserveCells) - 1] : DEFAULT_COLOR; Color color = i - this.reserveCells < size ? colors[size - (i - this.reserveCells) - 1] : DEFAULT_COLOR;
cell.setColor(color == null ? DEFAULT_COLOR : color); cell.setColor(color == null ? DEFAULT_COLOR : color);
} }
} }

Loading…
Cancel
Save