本文整理匯總了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);
}
}