package blitzEdit.core;

import java.awt.Rectangle;

import javafx.scene.canvas.GraphicsContext;

public abstract class Element 
{
	public int getX()
	{
		return _posX;
	}
	
	public int getY()
	{
		return _posY;
	}
	
	public int getSizeX()
	{
		return _sizeX;
	}
	
	public int getSizeY()
	{
		return _sizeY;
	}
	
	public Element setPosition(int x, int y)
	{
		_posX = x;
		_posY = y;
		return this;
	}
	
	//Bewegt das Element
	public abstract Element move(int x, int y);
	
	public boolean contains(int x, int y)
	{
		Rectangle rect = new Rectangle(_posX, _posY, _sizeX, _sizeY);
		return rect.contains(x, y);
	}
	
	public void draw(GraphicsContext gc, double scale)
	{
		
	}
	
	public Element(int x, int y)
	{
		_posX = x;
		_posY = y;
		_sizeX = 10;
		_sizeY = 10;
	}
	
	public Element(int x, int y, int sx, int sy)
	{
		_posX = x;
		_posY = y;
		_sizeX = sx;
		_sizeY = sy;
	}
	
	public Element()
	{
		_posX = 0;
		_posY = 0;
		_sizeX = 10;
		_sizeY = 10;
	}
	
	protected int _posX;
	protected int _posY;
	protected int _sizeX;
	protected int _sizeY;
	
}

@@ -45,16 +45,38 @@
 tangle;%0A
+import java.awt.Point;
 %0Aimport 
@@ -99,24 +99,11 @@
 vas.
-GraphicsContext;
+*;%0A
 %0A%0Apu
@@ -164,21 +164,37 @@
 %09return 
-_posX
+(int)_position.getX()
 ;%0A%09%7D%0A%09%0A%09
@@ -223,21 +223,37 @@
 %09return 
-_posY
+(int)_position.getY()
 ;%0A%09%7D%0A%09%0A%09
@@ -398,34 +398,39 @@
 %7B%0A%09%09_pos
-X = x;%0A%09%09_posY =
+ition.setLocation(x,
  y
+)
 ;%0A%09%09retu
@@ -512,16 +512,80 @@
 t y);%0A%09%0A
+%09public abstract void draw(GraphicsContext gc, double scale);%0A%09%0A
 %09public 
@@ -655,131 +655,340 @@
 gle(
-_posX, _posY, _sizeX, _sizeY);%0A%09%09return rect.contains(x, y);%0A%09%7D%0A%09%0A%09public void draw(GraphicsContext gc, double scale)%0A%09%7B%0A%09%09
+(int)_position.getX()-_sizeX/2, (int)_position.getY()-_sizeY/2,%0A%09%09%09%09%09%09%09%09%09%09_sizeX, _sizeY);%0A%09%09return rect.contains(x, y);%0A%09%7D%0A%09%0A%09public boolean intersects(Rectangle rect)%0A%09%7B%0A%09%09Rectangle r = new Rectangle((int)_position.getX()-_sizeX/2, %0A%09%09%09%09%09%09%09%09%09%09(int)_position.getY()-_sizeY/2,%0A%09%09%09%09%09%09%09%09%09%09_sizeX, _sizeY);%0A%09%09return r.intersects(rect);
 %0A%09%7D%0A
@@ -1028,34 +1028,39 @@
 %7B%0A%09%09_pos
-X = x;%0A%09%09_posY =
+ition = new Point(x,
  y
+)
 ;%0A%09%09_siz
@@ -1056,33 +1056,33 @@
  y);%0A%09%09_sizeX = 
-1
+2
 0;%0A%09%09_sizeY = 10
@@ -1071,33 +1071,33 @@
  20;%0A%09%09_sizeY = 
-1
+2
 0;%0A%09%7D%0A%09%0A%09public 
@@ -1147,26 +1147,31 @@
 _pos
-X = x;%0A%09%09_posY =
+ition = new Point(x,
  y
+)
 ;%0A%09%09
@@ -1234,26 +1234,30 @@
 _pos
-X = 0;%0A%09%09_posY = 0
+ition = new Point(0,0)
 ;%0A%09%09
@@ -1300,24 +1300,26 @@
 otected 
+Po
 int _pos
 X;%0A%09prot
@@ -1314,31 +1314,13 @@
 _pos
-X;%0A%09protected int _posY
+ition
 ;%0A%09p

Update Element.java