Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@evergis/react

Package Overview
Dependencies
Maintainers
6
Versions
357
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evergis/react - npm Package Compare versions

Comparing version 0.1.15 to 0.1.16

18

dist/hooks/useMapPick.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const es_1 = require("@evergis/api/es");
const commonEvents_1 = require("@evergis/sgis/es/commonEvents");
const react_1 = require("react");

@@ -8,3 +9,3 @@ const useMount_1 = require("./useMount");

exports.useMapPick = () => {
const { map } = MapContext_1.useMapContext();
const { map, painter } = MapContext_1.useMapContext();
const [geometryParams, setGeometryParams] = react_1.useState();

@@ -16,16 +17,9 @@ // TODO map layers now is not evergis layers

const pick = react_1.useCallback((event) => {
const clickEvent = event;
const { browserEvent } = clickEvent;
if (!browserEvent.target || !browserEvent.view) {
console.warn('browserEvent have no target or view properties');
if (!(event instanceof commonEvents_1.sGisClickEvent)) {
return;
}
const { clientWidth, clientHeight } = browserEvent.target;
const { innerWidth, innerHeight } = browserEvent.view;
const xOffset = innerWidth - clientWidth;
const yOffset = innerHeight - clientHeight;
const clickPoint = [browserEvent.x - xOffset, browserEvent.y - yOffset];
const imageRectangle = [0, 0, clientWidth, clientHeight];
const imageRectangle = [0, 0, painter.width, painter.height];
const [x, y] = painter.getPxPosition(event.point.position);
setGeometryParams({
clickPoint,
clickPoint: [Math.round(x), Math.round(y)],
envelopes: collectLayerEnvelopes(evergisLayers),

@@ -32,0 +26,0 @@ imageRectangle,

import { isEvergisDynamicLayer, } from '@evergis/api/es';
import { sGisClickEvent } from '@evergis/sgis/es/commonEvents';
import { useCallback, useMemo, useState } from 'react';

@@ -6,3 +7,3 @@ import { useMount } from './useMount';

export const useMapPick = () => {
const { map } = useMapContext();
const { map, painter } = useMapContext();
const [geometryParams, setGeometryParams] = useState();

@@ -14,16 +15,9 @@ // TODO map layers now is not evergis layers

const pick = useCallback((event) => {
const clickEvent = event;
const { browserEvent } = clickEvent;
if (!browserEvent.target || !browserEvent.view) {
console.warn('browserEvent have no target or view properties');
if (!(event instanceof sGisClickEvent)) {
return;
}
const { clientWidth, clientHeight } = browserEvent.target;
const { innerWidth, innerHeight } = browserEvent.view;
const xOffset = innerWidth - clientWidth;
const yOffset = innerHeight - clientHeight;
const clickPoint = [browserEvent.x - xOffset, browserEvent.y - yOffset];
const imageRectangle = [0, 0, clientWidth, clientHeight];
const imageRectangle = [0, 0, painter.width, painter.height];
const [x, y] = painter.getPxPosition(event.point.position);
setGeometryParams({
clickPoint,
clickPoint: [Math.round(x), Math.round(y)],
envelopes: collectLayerEnvelopes(evergisLayers),

@@ -30,0 +24,0 @@ imageRectangle,

{
"name": "@evergis/react",
"version": "0.1.15",
"version": "0.1.16",
"description": "React components for creating GIS apps with evergis server",

@@ -5,0 +5,0 @@ "author": "everpoint",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc