當前位置: 首頁>>代碼示例>>Java>>正文


Java HandleGesture.getDeltaY方法代碼示例

本文整理匯總了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);
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:20,代碼來源:Line.java

示例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);
	}
}
 
開發者ID:reds-heig,項目名稱:logisim-evolution,代碼行數:18,代碼來源:Line.java

示例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);
	}
}
 
開發者ID:franciscaconcha,項目名稱:ProyectoLogisim,代碼行數:18,代碼來源:Line.java

示例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);
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:15,代碼來源:Line.java

示例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);
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:47,代碼來源:Poly.java

示例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);
	}
}
 
開發者ID:franciscaconcha,項目名稱:ProyectoLogisim,代碼行數:45,代碼來源:Poly.java


注:本文中的com.cburch.draw.model.HandleGesture.getDeltaY方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。