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

Update the current strokes state after erasing #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rmsandu
Copy link

@rmsandu rmsandu commented Sep 13, 2016

When using the erase button the line would be erased visually, but it wouldn't remove the respective strokes from the array. The equiv function seems to be outdated and the comparison fails.

If saving of the strokes (offline raster image) is wanted (with RaphaelExport, canvg) this update will render the correct strokes.

hen using the erase button the line would be erased visually, but it wouldn't update the array with the strokes. The equiv function seems to be outdated and the comparison fails.

If saving of the strokes is needed (with RaphaelExport, canvg) this update will render the correct strokes.
Raluca Sandu added 2 commits September 13, 2016 16:34
Zoom on MouseWheel Event using the Scale() function implemented in raphael.sketchpad.js
Using the Scale() function forked from Raphael I created an example which zooms in the sketchpad on MouseWheelHandler event and button click. The offset that appeared earlier is accounted for by modifying the height relative to the width.
@cecilpeng
Copy link

cecilpeng commented May 10, 2017

the right solution is to protect the data format of the stored strokes. It is broken after having called sketchpad.json(). Please use var _strokes_copy = jQuery.extend(true, [], _strokes_copy, _strokes); instead.

self.json = function(value) {
            if (value === undefined) {
                var _strokes_copy = jQuery.extend(true, [], _strokes_copy, _strokes);
                for (var i = 0, n = _strokes_copy.length; i < n; i++) {
                    var stroke = _strokes_copy[i];
                    if (typeof stroke.path == "object") {
                        stroke.path = svg_path_to_string(stroke.path);
                    }
                }
                return JSON.stringify(_strokes_copy);
            }

            return self.strokes(JSON.parse(value));
        };

@rmsandu
Copy link
Author

rmsandu commented Dec 1, 2020

@cecilpeng thanks for your solution. can you show me the exact bug? I can updated it in the pull request then....anyways I feel OP is not updating this repository anymore. Feel free to check out my version of it, based on the same website : https://github.com/raluca-san/IAT-image-annotation-website

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

Successfully merging this pull request may close these issues.

2 participants