Esempio n. 1
0
    def fix_coordinates(self, item):
        """
		Interprets the coordinates based on whether coordinates
		is set to absolute or relative.
		Raw/ relative -> Raw coordinates
		"""

        item = item.copy()
        if self.get("coordinates") == "relative":
            for var in item:
                if var in ["x", "x1", "x2"]:
                    item[var] += self.get("width") / 2
                if var in ["y", "y1", "y2"]:
                    item[var] += self.get("height") / 2
        return item
Esempio n. 2
0
	def fix_coordinates(self, item):
	
		"""
		Interprets the coordinates based on whether coordinates
		is set to absolute or relative.
		Raw/ relative -> Raw coordinates
		"""
		
		item = item.copy()
		if self.get("coordinates") == "relative":
			for var in item:
				if var in ["x", "x1", "x2"]:
					item[var] += self.get("width") / 2
				if var in ["y", "y1", "y2"]:
					item[var] += self.get("height") / 2
		return item
Esempio n. 3
0
    def fix_coordinates(self, item):
        """
		Interprets the coordinates based on whether 'coordinates' is set to
		absolute or relative. Raw/ relative -> Raw coordinates

		Arguments:
		item -- a sketchpad element

		Returns:
		The 'fixed' sketchpad element
		"""

        item = item.copy()
        for var in item:
            if type(item[var]) in (int, float):
                if var in ["x", "x1", "x2"]:
                    item[var] += self.get("width") / 2
                if var in ["y", "y1", "y2"]:
                    item[var] += self.get("height") / 2
        return item
Esempio n. 4
0
	def fix_coordinates(self, item):

		"""
		Interprets the coordinates based on whether 'coordinates' is set to
		absolute or relative. Raw/ relative -> Raw coordinates

		Arguments:
		item -- a sketchpad element

		Returns:
		The 'fixed' sketchpad element
		"""

		item = item.copy()
		for var in item:
			if type(item[var]) in (int, float):
				if var in ["x", "x1", "x2"]:
					item[var] += self.get("width") / 2
				if var in ["y", "y1", "y2"]:
					item[var] += self.get("height") / 2
		return item