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

Fix size of 'pieces', no border #202

Open
JamesPHoughton opened this issue Jan 29, 2019 · 3 comments
Open

Fix size of 'pieces', no border #202

JamesPHoughton opened this issue Jan 29, 2019 · 3 comments

Comments

@JamesPHoughton
Copy link

I'm creating a question in which students assemble a puzzle by putting components into the correct place on the background image. To be precise, they see this background image:

and have pieces to fill in:

etc...

such that the final result should look like this:

I can create zones that match the locations for the pieces with no problems:
image

and I can set the percentage width that the pieces should take up in the image, but the pieces are given a blue border that I can't remove, such that the 'puzzle' looks like:

screen shot 2019-01-29 at 2 07 45 pm

This could be fixed by removing the border on images, or allowing it's width to be set to 0. Is there a way I can do this?

It would be nice, although isn't strictly necessary, to specify that the pieces merely use the same resolution as the background image, as this would size them appropriately without having to do the percentage adjustment.

@JamesPHoughton
Copy link
Author

Attempted workaround:

Set the piece color background to a transparent color: #ffffff00 means that the border is now clear.

Then offset the boxes to the left and upward, so that the upper left corner puts the center of the image in the correct location
image

(Having to do this because despite selecting that items should be center aligned, they still seem to be left aligned.)

Setting the piece width percentages to account for the (now invisible border), this looks approximately correct:

image

However, the piece width percentage seems to be set to the width of the window, not the width of the image, so resizing the browser window distorts the piece fitting:

(Larger window size)
image

(Smaller window size)
image

Setting the pieces and the background to display at the same resolution (assuming they were created at the same resolution) would fix this.

@JamesPHoughton
Copy link
Author

JamesPHoughton commented Jan 29, 2019

Rethinking this, the zone definitions are specified in terms of width, height, x and y in the pixels of the background image. I'd like to be able to set exactly the same parameters for the items: their width and height in pixels of the original image, and the x and y locations of their upper left corners.

@JamesPHoughton
Copy link
Author

Seems like the ability to set item size was included in the previous version, but removed to improve mobile compatibility:

https://github.com/edx-solutions/xblock-drag-and-drop-v2/blob/5aaeef5b6861cee13aee4119e56e7ab1d39876cb/drag_and_drop_v2/public/js/drag_and_drop_edit.js#L607-L609

but that it's still there somewhere:
https://github.com/edx-solutions/xblock-drag-and-drop-v2/blob/5aaeef5b6861cee13aee4119e56e7ab1d39876cb/drag_and_drop_v2/public/js/drag_and_drop_edit.js#L615-L616

Is the solution to just use the old style drag-and-drop?

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