rebootcode / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
0 stars 0 forks source link

Move element in Chrome error #1004

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Select Layer 1
2. Draw rectangle on Layer 1
3. Create second layer (Layer 2)
4. Draw rectangle on Layer 2
5. Select "Select tool"
6. Click on canvas
7. Click on rectangle of Layer 2
8. Change layer
9. Both rectangle will be movable
10. Click on the rectangle whose layer is not selected

What is the expected output? What do you see instead?
Expected:
Move pointer on object of unselected layer, error after click.
Uncaught TypeError: Cannot read property 'parentNode' of null svgcanvas.js:2317
getMouseTarget.getMouseTarget svgcanvas.js:2317
mouseDown svgcanvas.js:2384
f.event.dispatch jquery.js:3
f.event.add.h.handle.i jquery.js:3

Instead:
Only rectangle of selected layer is movable.

In what browser did you experience this problem? (ALL, Firefox, Opera, etc)
Chrome 21

In what version of SVG-edit does the problem occur? (Latest trunk, 2.5.1,
etc)
Latest trunk

Please provide any additional information below.

Original issue reported on code.google.com by hajdua...@gmail.com on 24 Aug 2012 at 8:17

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Please review this patch:

// Disable other elements
$(elem).parentsUntil('#svgcontent > g').andSelf().siblings().each(function() {
    var opac = this.getAttribute('opacity') || 1;
    // Store the original's opacity
    elData(this, 'orig_opac', opac);
    this.setAttribute('opacity', opac * .33);
    this.setAttribute('style', 'pointer-events: none');
    disabled_elems.push(this);
});

Original comment by hajdua...@gmail.com on 30 Oct 2012 at 8:08

GoogleCodeExporter commented 8 years ago
Seems like a bug in Chrome. The style overrides in svg-editor.js

$('#styleoverrides').text('#svgcanvas svg *{cursor:move;pointer-events:all} 
#svgcanvas svg{cursor:default}');

Are overriding the <g style="pointer-events: none">.

I'll have to investigate further in order to find a good solution.

Original comment by duopi...@gmail.com on 28 Nov 2012 at 8:07

GoogleCodeExporter commented 8 years ago
As far as I know -- and tested recently -- scoped="scoped" is not supported in 
any browser. So the styles will apply outside of the scoped element.

Don't know if that will help, just calling #styleoverrides out.

Original comment by asyazwan on 29 Nov 2012 at 3:06

GoogleCodeExporter commented 8 years ago
The above fixes solved this problem in my project.

Original comment by hajdua...@gmail.com on 29 Nov 2012 at 8:01