Git Product home page Git Product logo

Comments (3)

vera-l avatar vera-l commented on July 29, 2024

Hi,

I'm not sure I understand the question, you can attach your code to this topic, and I will try to resolve this problem.

from summer.

joshreade avatar joshreade commented on July 29, 2024

Thanks for your reply.
So I have modified the localStorageWrapper so instead of saving/reading from local storage it now saves the coordinates in a database.

This works and I am able to save and load successfully.

I have also replaced the url/drag and drop section for loading images with a select menu of predefined images, this also works as expected.

What I would like is for the restore function to fire as soon as an image has been selected and loaded onto the canvas, instead of having to click 'load'.

When I tried this however it kept loading the hotspots in a loop and layering them on top of eachother.
I hope this makes sense, let me know if you need to see any more code.

Thanks

#loadurl is a hidden field with the filename of the image which is currently loaded into the canvas

var localStorageWrapper = (function() {

		   var KEY_NAME = 'SummerHTMLImageMapCreator';
          
            return {
                save : function() {
					
					
                    var result = areasIO.toJSON();
					console.log(areasIO);
					 $.ajax({
							url: 'savedata.php',
							type: 'post',
							data: {model:KEY_NAME,result:result},
							success: function(data){
								console.info('Saved in Database');
								alert('Saved');
							}
						});  
                    
                },
                restore : function() {

					
var namefromfield=$("#loadurl").val();
					namefromfield=namefromfield.split('|');
					var imgurl=namefromfield[0];
					var getmodelname=namefromfield[1];
					$.ajax({
							url: 'getdata.php',
							type: 'post',
							data: {imgurl:imgurl,model:getmodelname},
							success: function(data){
								console.log(data);
								   areasIO.fromJSON(data);
							}
						}); 
					
					
       
                }
            };
        })();

from summer.

summerstyle avatar summerstyle commented on July 29, 2024

I need to see all changes, incl. menu of predefined images

from summer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.