Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with right to left #247

Open
gilteitelbaum opened this issue May 15, 2017 · 0 comments
Open

Problem with right to left #247

gilteitelbaum opened this issue May 15, 2017 · 0 comments

Comments

@gilteitelbaum
Copy link

I have a test case that works correctly when rightToLeft is false (actually I dont include the attribute).
When I change the test case to use rightToLeft is true, moving around elements doesnt work smoothly.

Below is my example for right to left (which was modified from the example draggable and run from the example directory)

	
		
		
		<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="../freewall.js"></script>
	<style type="text/css">
		.free-wall {
			margin: 5px;
		}
		.cell {
			cursor: move;
		}
		.cell .cover {
			padding: 5px;
		}
		.handle {
			border: 1px dotted orange;
			padding: 4px
		}
	</style>
</head>
<body>
	<div class="layout">
		<div id="freewall" class="free-wall">
			<div class='cell' style='width:140px; height: 140px; background-color:rgb(142, 68, 173)' data-handle=".handle">
				<div class='cover'>
					<div class='handle'>Drag item handle</div>
				</div>
			</div>
			<div class='cell' style='width:140px; height: 140px; background-color:rgb(142, 68, 173)' data-handle=".handle">
				<div class='cover'>
					<div class='handle'>Drag item handle</div>
				</div>
			</div>
			<div class='cell' style='width:420px; height: 280px; background-color:rgb(142, 68, 173)' data-handle=".handle">
				<div class='cover'>
					<div class='handle'>Drag item handle</div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">

		var temp = "<div class='cell' style='width:{width}px; height: {height}px; background-color: {color}'><div class='cover'>Demo draggable</div></div>";
		var colour = [
			"rgb(243, 156, 18)",
			"rgb(211, 84, 0)",
			"rgb(142, 68, 173)"
		];

		function addElement(isBig)
		{
			if (isBig)
			{
				h = 2;
				w = 3;
			}
			else {
				h = w = 1;
			}
			color = colour[colour.length * Math.random() << 0];
			html = temp.replace(/\{height\}/g, h*140).replace(/\{width\}/g, w*140).replace("{color}", color);
			$("#freewall").append(html);
		}
		
		addElement(false);
		addElement(false);
		addElement(false);
		addElement(true);
		addElement(false);
		addElement(false);
		addElement(false);
		addElement(true);
		addElement(false);
		addElement(false);
		addElement(false);
		addElement(false);
		addElement(false);

		var wall = new Freewall("#freewall");
		wall.reset({
			draggable: true,
			selector: '.cell',
			animate: true,
			cellW: 140,
			cellH: 140,
			rightToLeft: true,
			fixSize: false,
			gutterX: 10,
			gutterY: 10, 			
			onResize: function() {
				wall.refresh();
			},
			onBlockMove: function() {
				console.log(this);
			}
		});
		wall.fitWidth();
		// for scroll bar appear;
		$(window).trigger("resize");
	</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant