Skip to content

removeOffCanvasPaths removes wrong paths #1646

Open
@cyberalien

Description

Describe the bug
Plugin removeOffCanvasPaths removes paths that are on canvas

To Reproduce
Steps to reproduce the behavior:

const { optimize } = require('svgo');
console.log(
	optimize(
		'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2" d="m12 12 7 7m-7-7L5 5m7 7-7 7m7-7 7-7"/></svg>',
		{ plugins: ['removeOffCanvasPaths'] }
	)
);

Result:

{
  data: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"/>',
  info: { width: '24', height: '24' }
}

Expected behavior
Expected path to not be removed. Path is within canvas.

Desktop (please complete the following information):

  • SVGO Version: 2.8.0
  • NodeJs Version: 16.3.2
  • OS: macOS 12.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions