本文整理汇总了Java中com.cburch.draw.model.HandleGesture.getDeltaY方法的典型用法代码示例。如果您正苦于以下问题:Java HandleGesture.getDeltaY方法的具体用法?Java HandleGesture.getDeltaY怎么用?Java HandleGesture.getDeltaY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.cburch.draw.model.HandleGesture
的用法示例。
在下文中一共展示了HandleGesture.getDeltaY方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paint
import com.cburch.draw.model.HandleGesture; //导入方法依赖的package包/类
@Override
public void paint(Graphics g, HandleGesture gesture) {
if (setForStroke(g)) {
int x0 = this.x0;
int y0 = this.y0;
int x1 = this.x1;
int y1 = this.y1;
Handle h = gesture.getHandle();
if (h.isAt(x0, y0)) {
x0 += gesture.getDeltaX();
y0 += gesture.getDeltaY();
}
if (h.isAt(x1, y1)) {
x1 += gesture.getDeltaX();
y1 += gesture.getDeltaY();
}
g.drawLine(x0, y0, x1, y1);
}
}
示例2: getHandles
import com.cburch.draw.model.HandleGesture; //导入方法依赖的package包/类
@Override
public List<Handle> getHandles(HandleGesture gesture) {
if (gesture == null) {
return UnmodifiableList.create(new Handle[] {
new Handle(this, x0, y0), new Handle(this, x1, y1) });
} else {
Handle h = gesture.getHandle();
int dx = gesture.getDeltaX();
int dy = gesture.getDeltaY();
Handle[] ret = new Handle[2];
ret[0] = new Handle(this, h.isAt(x0, y0) ? Location.create(x0 + dx,
y0 + dy) : Location.create(x0, y0));
ret[1] = new Handle(this, h.isAt(x1, y1) ? Location.create(x1 + dx,
y1 + dy) : Location.create(x1, y1));
return UnmodifiableList.create(ret);
}
}
示例3: getHandles
import com.cburch.draw.model.HandleGesture; //导入方法依赖的package包/类
@Override
public List<Handle> getHandles(HandleGesture gesture) {
if (gesture == null) {
return UnmodifiableList.create(new Handle[] {
new Handle(this, x0, y0), new Handle(this, x1, y1) });
} else {
Handle h = gesture.getHandle();
int dx = gesture.getDeltaX();
int dy = gesture.getDeltaY();
Handle[] ret = new Handle[2];
ret[0] = new Handle(this, h.isAt(x0, y0)
? Location.create(x0 + dx, y0 + dy) : Location.create(x0, y0));
ret[1] = new Handle(this, h.isAt(x1, y1)
? Location.create(x1 + dx, y1 + dy) : Location.create(x1, y1));
return UnmodifiableList.create(ret);
}
}
示例4: getHandles
import com.cburch.draw.model.HandleGesture; //导入方法依赖的package包/类
@Override
public List<Handle> getHandles(HandleGesture gesture) {
if (gesture == null) {
return UnmodifiableList.create(new Handle[] { new Handle(this, x0, y0), new Handle(this, x1, y1) });
} else {
Handle h = gesture.getHandle();
int dx = gesture.getDeltaX();
int dy = gesture.getDeltaY();
Handle[] ret = new Handle[2];
ret[0] = new Handle(this, h.isAt(x0, y0) ? Location.create(x0 + dx, y0 + dy) : Location.create(x0, y0));
ret[1] = new Handle(this, h.isAt(x1, y1) ? Location.create(x1 + dx, y1 + dy) : Location.create(x1, y1));
return UnmodifiableList.create(ret);
}
}
示例5: getHandles
import com.cburch.draw.model.HandleGesture; //导入方法依赖的package包/类
@Override
public List<Handle> getHandles(HandleGesture gesture) {
Handle[] hs = handles;
if (gesture == null) {
return UnmodifiableList.create(hs);
} else {
Handle g = gesture.getHandle();
Handle[] ret = new Handle[hs.length];
for (int i = 0, n = hs.length; i < n; i++) {
Handle h = hs[i];
if (h.equals(g)) {
int x = h.getX() + gesture.getDeltaX();
int y = h.getY() + gesture.getDeltaY();
Location r;
if (gesture.isShiftDown()) {
Location prev = hs[(i + n - 1) % n].getLocation();
Location next = hs[(i + 1) % n].getLocation();
if (!closed) {
if (i == 0)
prev = null;
if (i == n - 1)
next = null;
}
if (prev == null) {
r = LineUtil.snapTo8Cardinals(next, x, y);
} else if (next == null) {
r = LineUtil.snapTo8Cardinals(prev, x, y);
} else {
Location to = Location.create(x, y);
Location a = LineUtil.snapTo8Cardinals(prev, x, y);
Location b = LineUtil.snapTo8Cardinals(next, x, y);
int ad = a.manhattanDistanceTo(to);
int bd = b.manhattanDistanceTo(to);
r = ad < bd ? a : b;
}
} else {
r = Location.create(x, y);
}
ret[i] = new Handle(this, r);
} else {
ret[i] = h;
}
}
return UnmodifiableList.create(ret);
}
}
示例6: getHandles
import com.cburch.draw.model.HandleGesture; //导入方法依赖的package包/类
@Override
public List<Handle> getHandles(HandleGesture gesture) {
Handle[] hs = handles;
if (gesture == null) {
return UnmodifiableList.create(hs);
} else {
Handle g = gesture.getHandle();
Handle[] ret = new Handle[hs.length];
for (int i = 0, n = hs.length; i < n; i++) {
Handle h = hs[i];
if (h.equals(g)) {
int x = h.getX() + gesture.getDeltaX();
int y = h.getY() + gesture.getDeltaY();
Location r;
if (gesture.isShiftDown()) {
Location prev = hs[(i + n - 1) % n].getLocation();
Location next = hs[(i + 1) % n].getLocation();
if (!closed) {
if (i == 0) prev = null;
if (i == n - 1) next = null;
}
if (prev == null) {
r = LineUtil.snapTo8Cardinals(next, x, y);
} else if (next == null) {
r = LineUtil.snapTo8Cardinals(prev, x, y);
} else {
Location to = Location.create(x, y);
Location a = LineUtil.snapTo8Cardinals(prev, x, y);
Location b = LineUtil.snapTo8Cardinals(next, x, y);
int ad = a.manhattanDistanceTo(to);
int bd = b.manhattanDistanceTo(to);
r = ad < bd ? a : b;
}
} else {
r = Location.create(x, y);
}
ret[i] = new Handle(this, r);
} else {
ret[i] = h;
}
}
return UnmodifiableList.create(ret);
}
}