Socket
Socket
Sign inDemoInstall

dxf-viewer

Package Overview
Dependencies
5
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.4 to 1.0.5

2

package.json
{
"name": "dxf-viewer",
"version": "1.0.4",
"version": "1.0.5",
"description": "JavaScript DXF file viewer",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -585,4 +585,6 @@ import {DynamicBuffer, NativeType} from "./DynamicBuffer"

const nestedCtx = blockCtx.NestedBlockContext(block, entity)
for (const entity of block.data.entities) {
this._ProcessDxfEntity(entity, nestedCtx)
if (block.data.entities) {
for (const entity of block.data.entities) {
this._ProcessDxfEntity(entity, nestedCtx)
}
}

@@ -661,2 +663,32 @@ return

/** Mirror entity vertices if necessary in case of extrusionDirection with negative Z specified.
*
* @param entity Entity to check.
* @param vertices {?{x,y}[]} Vertices array to use instead of entity vertices attribute.
* @return {{x,y}[]} Vertices array with mirrored X if necessary. All attributes preserved.
*/
_MirrorEntityVertices(entity, vertices = null) {
if (!entity.extrusionDirection || entity.extrusionDirection.z >= 0) {
return vertices ?? entity.vertices
}
if (!vertices || vertices === entity.vertices) {
vertices = entity.vertices.slice()
}
const n = vertices.length
for (let i = 0; i < n; i++) {
const v = vertices[i]
const _v = {x: -v.x}
for (const propName in v) {
if (!v.hasOwnProperty(propName)) {
continue
}
if (propName !== "x") {
_v[propName] = v[propName]
}
}
vertices[i] = _v
}
return vertices
}
*_DecomposePolyline(entity, blockCtx = null) {

@@ -674,2 +706,3 @@ let entityVertices, verticesCount

}
entityVertices = this._MirrorEntityVertices(entity, entityVertices)
const color = this._GetEntityColor(entity, blockCtx)

@@ -1436,5 +1469,14 @@ const layer = this._GetEntityLayer(entity, blockCtx)

const mInsert = new Matrix3().translate(-this.origin.x, -this.origin.y)
mInsert.scale(entity.xScale || 1, entity.yScale || 1)
mInsert.rotate(-(entity.rotation || 0) * Math.PI / 180)
mInsert.translate(entity.position.x, entity.position.y)
let yScale = entity.yScale || 1
const xScale = entity.xScale || 1
const rotation = -(entity.rotation || 0) * Math.PI / 180
let x = entity.position.x
const y = entity.position.y
if (entity.zScale < 0) {
yScale = -yScale
x = -x
}
mInsert.scale(xScale, yScale)
mInsert.rotate(rotation)
mInsert.translate(x, y)
if (this.type !== BlockContext.Type.INSTANTIATION) {

@@ -1441,0 +1483,0 @@ return mInsert

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc